GarTomlon
Enthusiast
Enthusiast

Populating dropdown list with VMS from specific vsphere folder.

Jump to solution

I am looking to have an input array of VMs,  I am wanting the VMs of a specifc folder to be the VMs I select from.  How would I do this on my presentation tab?  I know to have an input parameter  vc:virtualmachine array.  But where would the logic come from in creating the dropdown list?

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

First, create an attribute in your workflow. Set the type of the attribute to be VC:VmFolder, and select its value to be the specific folder you have to select VMs from.

Then, go to the Presentation tab of your workflow. Add 'Select value as' property with value 'list' (this will make the input to show as dropdown). Then, add another property 'Predefined list of elements', and click 'Help create Action call' tool button (the second/rightmost tool button in the property value row). In the chooser dialog, choose either action getAllVirtualMachinesByFolder or getAllVirtualMachinesByFolderIncludingSubFolders (what these actions do should be pretty much evident from their names). In the second input control in this dialog, select the folder attribute created on step 1; this will become the parameter to the action call.

After choosing the action, the value for this presentation property should look something like:

    GetAction("com.vmware.library.vc.folder","getAllVirtualMachinesByFolder").call( #mySpecificFolder )

That's all.

View solution in original post

0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

First, create an attribute in your workflow. Set the type of the attribute to be VC:VmFolder, and select its value to be the specific folder you have to select VMs from.

Then, go to the Presentation tab of your workflow. Add 'Select value as' property with value 'list' (this will make the input to show as dropdown). Then, add another property 'Predefined list of elements', and click 'Help create Action call' tool button (the second/rightmost tool button in the property value row). In the chooser dialog, choose either action getAllVirtualMachinesByFolder or getAllVirtualMachinesByFolderIncludingSubFolders (what these actions do should be pretty much evident from their names). In the second input control in this dialog, select the folder attribute created on step 1; this will become the parameter to the action call.

After choosing the action, the value for this presentation property should look something like:

    GetAction("com.vmware.library.vc.folder","getAllVirtualMachinesByFolder").call( #mySpecificFolder )

That's all.

0 Kudos