VMware Cloud Community
salil3
Contributor
Contributor

Setting the attribute from the presentation using OGNL expression

One of the requirement while dynamically populating the fields using OGNL expression is to maintain some metadata with the field so that same can be used by scripting elements along with the field value. So in order to achieve this, I created a composite type attribute parameter for the input parameter and pass the same to the actions element called from within the OGNL expression. Inside the actions element I populated the passed in composite type with the corresponding values but surprisingly when I tried to access the composite type post OGNL expression execution  the value were not set.

So the question is how to set the composite type attribute from within actions called from within the OGNL expression.

For e.g. In the below case I would like to populate the composite attribute "scInstanceMapping" from within the action element getScList() and then populate the input parameter with the names property of the composite attribute.

Predefined answers :- GetAction("com.myactions","getScList").call( #manager,#scInstanceMapping), #scInstanceMapping["names"]

Any help on this will be highly appreciated. BTW I am using the version 5.5.2.1 of VCO appliance.

Thanks in advance,

Salil

0 Kudos
7 Replies
cdecanini_
VMware Employee
VMware Employee

A composite type is set like a Properties type:

var compositeType = new Properties();

compositeType.put(key1, value1);

compositeType.put(key2, value2);

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
salil3
Contributor
Contributor

Thanks for your prompt response I really appreciated that.

I tried that but still it didn't worked for me. I want the attribute parameter "scInstanceMapping" to be set to the return value of the action "getScList" invoked from within the OGNL expression below

OGNL Expression 1 : #scInstanceMapping=GetAction("my.module","getScList").call( #manager), #scInstanceMapping.get("names")

The above works fine for the current input field but when  the same attribute "scInstanceMapping" is passed as an input parameter to some other action "getVolumeFolderList" as stated below it complaints that it is null


OGNL Expression 2 : #folderInstanceMapping=GetAction("my.module","getVolumeFolderList").call( #scInstanceMapping),#folderInstanceMapping.get("names")


Question is how to set the "scInstanceMapping" attribute in Expression 1 so that it is available for Expression 2?


Thanks in advance,

Salil



0 Kudos
salil3
Contributor
Contributor

I tried that but still it didn't worked for me. I want the attribute parameter "scInstanceMapping" to be set to the return value of the action "getScList" invoked from within the OGNL expression below

OGNL Expression 1 : #scInstanceMapping=GetAction("my.module","getScList").call( #manager), #scInstanceMapping.get("names")

The above works fine for the current input field but when  the same attribute "scInstanceMapping" is passed as an input parameter to some other action "getVolumeFolderList" as stated below it complaints that it is null


OGNL Expression 2 : #folderInstanceMapping=GetAction("my.module","getVolumeFolderList").call( #scInstanceMapping),#folderInstanceMapping.get("names")


Question is how to set the "scInstanceMapping" attribute in Expression 1 so that it is available for Expression 2?


Thanks in advance,

Salil

0 Kudos
sdavros
Contributor
Contributor

this might be over simplified, but the first thought that struck me would be to make #scInstanceMapping an attribute?
0 Kudos
salil3
Contributor
Contributor

#scInstanceMapping is already declared as an attribute under Gneneral tab but still it is not getting set as part of OGNL expression.


Please see the attachment.


Thanks,

Salil

0 Kudos
salil3
Contributor
Contributor

Hi

I am stuck on this. Any help on this will be very much appreciated

Thanks in advance,

Salil

0 Kudos
sappomannoz
Hot Shot
Hot Shot

HI!

Did you manage to solve this issue?

Cristiano

0 Kudos