VMware Cloud Community
jamesreinke2
Enthusiast
Enthusiast
Jump to solution

Pass a variable from a dropdown

Still being new to Orchestrator I hope this is an easy question. How can you pass a selection from a drop-down or rather a predefined list of elements to a variable? Included are a couple of snip-its if that will help. Im sure this question is probably very simple for the the majority in this forum.

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

What do you mean by passing it to a variable?

The input parameter name is vms3 (of type string), and this variable will contain the value selected in the dropdown. Eg. you can reference it in other OGNL expressions as #vms3, or bind it as IN parameter to some workflow elements using the client editor UI.

View solution in original post

Reply
0 Kudos
6 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

What do you mean by passing it to a variable?

The input parameter name is vms3 (of type string), and this variable will contain the value selected in the dropdown. Eg. you can reference it in other OGNL expressions as #vms3, or bind it as IN parameter to some workflow elements using the client editor UI.

Reply
0 Kudos
jamesreinke2
Enthusiast
Enthusiast
Jump to solution

If someone makes a selection like "SO-062" the listing in the "capture 1" picture I would like to grab that and use it in another part of the workflow.

Reply
0 Kudos
jamesreinke2
Enthusiast
Enthusiast
Jump to solution

Sorry didn't finish. What is an "OGNL expression" and can you give me an example

Reply
0 Kudos
jamesreinke2
Enthusiast
Enthusiast
Jump to solution

Hopfully this doesnt seem like a silly question but if vms3 is a string how do i display that?

Im getting an error.

Error:

Error in (Workflow:Lets See 2 / Scriptable task (item4)#2) TypeError: Cannot read property "name" from null

[2017-11-17 10:29:35.789] [E] Workflow execution stack:

***

item: 'Lets See 2/item4', state: 'failed', business state: 'null', exception: 'TypeError: Cannot read property "name" from null (Workflow:Lets See 2 / Scriptable task (item4)#2)'

workflow: 'Lets See 2' (10b2a200-e46d-4e7f-a940-2e11261f97cc)

|  'attribute': name=vms2 type=Array/string value=#{#string#SO-062#;#string#SO-066#;#string#SO-065#;#string#SO-021#;#string#SO-067-jlh-practice#;#string#SO-053#;#string#SO-063#;#string#SO-ivm100055-Dell-OpenManage-Essentials#;#string#SO-Renamed#;#string#SO-013#}#

|  'attribute': name=vm_old type=string value=

|  'input': name=VM_Folder type=string value=SO

|  'output': name=vms3 type=string value=SO-062

*** End of execution stack.

Example:    System.log("vms3 = " + vms3.name); ?

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Strings do not have property name, so expression line vms3.name is not valid. The value should be accessible just as vms3.

Could you export your test workflow and attach it here? I guess it will be easier to check where are the errors if we can take a look at the workflow.

Reply
0 Kudos
jamesreinke2
Enthusiast
Enthusiast
Jump to solution

Got it. There were a couple of things wrong. Ilian, you were right of course about the vms3 not having the .name after it and it being an input parameter. But I did have to also (my bad) change the array that it was working from to an attribute. So thank you fro your help. You pointed me in the right direction.

Reply
0 Kudos