VMware Cloud Community
BobWieberdink
Contributor
Contributor

Having Trouble running an Action in XaaS - Action Runs Fine In A Resource Action....

I need help with running vRO Action in a vRA form. My action seems to work when running to populate a list box on a form in a Resource Action, but cannot get the Action to populate a list box in a XaaS Blueprint. I am trying to use the following action:

System.log("listVirtualMachineForOwner Action")

var cafeHosts = Server.findAllForType("vCACCAFE:VCACHost");

for each (cafeHostLookUp in cafeHosts)

{

if (cafeHostLookUp.name === "Testing")

{

cafeHost = cafeHostLookUp

}

}

var service = cafeHost.createCatalogClient().getCatalogConsumerResourceService();

var filter = new Array();

filter[0] = vCACCAFEFilterParam.substringOf("owners/ref", vCACCAFEFilterParam.string(currentUser));

var query = vCACCAFEOdataQuery.query().addFilter(filter);

System.log("Query: " + query);

var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));

var serverNames = []

for each (item in items)

{

if (item.resourceTypeRef.id === "Infrastructure.Virtual" && item.resourceTypeRef.label === "Virtual Machine")

{

serverNames.push(item.name)

}

}

System.log("ServerNames: " + serverNames)

return serverNames

When I use the above code to populate a list box in a Resource Action (with currentUser populated by the Field Value - Principle ID) it returns all the servers owned by an ID.  When I try to use the exact same Action with an XaaS Blueprint, the list box does not populate. I can see the Action run in both cases and return values in both cases in LogInsight. Is there some difference in the setup between running an Action in a Resource Action and running an Action in an XaaS Blueprint? All this action does is populate the list box with serverNames so the user can choose what server to supply to the workflow. Am I missing something in the configuration in the XaaS blueprint?

Any assistance would be greatly appreciated.

Bob Wieberdink

0 Kudos
1 Reply
daphnissov
Immortal
Immortal

If you change your serverNames var to initialize the array first, does that make a difference?

0 Kudos