VMware Cloud Community
pezh0re
Enthusiast
Enthusiast

vRO Action driven Dynamic inputs

Is there a way to add a dynamic number of inputs based on a vRO action output? I'm working on a vRO workflow that will ask a user for vCenter tags to apply to a VM - but the tagging categories may change as time goes on. I'd prefer not to hard code anything if I can help it.

I currently have a workflow that populates predefined list/answers from actions (leveraging the VAPI), but I'd like to get to the next step and have the user provide input for each of the vCenter tag categories.

Tags (2)
0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

No, vRO presentation does not allow dynamic creation of input fields, you can only show/hide existing inputs.

So one possible option is to create the maximum anticipated number of inputs upfront, and then dynamically show/hide part of them. This would work if there is a sane upper limit on the number of inputs.

Another possible option is to implement sort of a loop, and in each loop iteration collect one or few inputs using a user interaction element. This might work, with some assumptions (eg. that the client option to automatically pop up a user interaction form is turned on).

0 Kudos
pezh0re
Enthusiast
Enthusiast

Would it be possible to use dynamic types somehow to accomplish this? Create a dynamic type with the various tag categories, then have that be a static input for a workflow?

0 Kudos
iiliev
VMware Employee
VMware Employee

No, dynamic types serve a different purpose. What you are describing here sounds closer to so called 'composite types', but they are also not so flexible to allow dynamic creation of their fields at runtime.

0 Kudos
brandtjohnd
Contributor
Contributor

I do have a workflow that we use to assign a single tag to one or many VM's at a time.  In the presentation of this we ask for VM Name, Tag Category & Tag Value.  The Tag Category is populated by an action that returns all the Tag Categories and sorts them for inclusion in a drop down.  So while this may not be exactly what you are looking for, it may be of some use.

Action Scripting

"

throw "'endpoint' parameter should not be null";

}

// Fetch tags and tag categories

var client = endpoint.client(); 

var category = new com_vmware_cis_tagging_category(client); 

var categories = category.list();

var sourceTagCats = new Array();

//Exclude Source tags in the "agency" category

for each(sourceTagCatId in categories){

sourceTagCat = (new com_vmware_cis_tagging_category(client)).get(sourceTagCatId);

if(sourceTagCat.name === 'agency'){

agencyTagCatId = sourceTagCat.id;

}

else{

sourceTagCatObj = new Object();

sourceTagCatObj.name = sourceTagCat.name;

sourceTagCatObj.id = sourceTagCat.id;

sourceTagCats.push(sourceTagCatObj.name);

}

}

sourceTagCats = sourceTagCats.sort()

return sourceTagCats

"

Then in the presentation tab of the workflow, you can set a property to the input attribute as "Predefined List of Elements"  See the Screenshot below.

Capture.PNG

Good luck

0 Kudos