VMware Cloud Community
millesonz
Enthusiast
Enthusiast

Start workflow in Parallel

Hey all,

I have a simple workflow to migrate a VM from one cluster of hosts to another. I want to be able to select multiple VMs and store them in an array and then run that workflow in parallel for all of the VMs in that array. I'm trying to use the "Start workflows in parallel" workflow to accomplish this. I have copied the workflow and begun to edit it so the Workflow is an attribute instead of an input. The issue is how to give the workflow the VMs that are selected and stored in the array as the parallel workflow is requesting an array of "properties" for the workflow instead of the VC:VirtualMachine type that my custom workflow is asking for.

How would I be able to pull this off?

Thanks,

-Zach

-Zach
0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

So you are asking how to populate array of properties given a list of VC:VirtualMachine objects?

Should be something like

parameters = new Array(); // array of properties

for (var i = 0; i < numberOfVMs; i++) {

  var wfInputProp = new Properties();

  wfInputProp.put("nameOfInputParam", objVM[i]);

  // ... put other inputs if needed by your custom wf

 

  parameters.push(wfInputProp);

}

-Ilian

0 Kudos