Hi Heja,
i though of extending the discussion of previous post to get the same result using dragging and dropping workflow elements instead of writing code on scriptable task.
following is what i am doing .
1:Dragging "for each " element and seach for "change ram" workflow as mentioned below.
2:
so following above method input parameters are automaticaly created as we are caling out of box "change ram " workflow .
however for some reasions (memory input parameter is taken as array automatically and iam not able to changetype from array to number)that workflow does not run .is it possible for you check this way and suggest what is missing ??
Hi jvm2016
When you add the for each workflow element and select the workflow you want to use with the loop you have to specify which array the for each element should loop through, all other parameters are then set to a static value.
To do this you want to:
1. In your workflow create input parameters or attributes for the VMs and Memory values. Your parameter for VMs needs to be an array of VC:VirtualMachine type and the Memory parameter needs to be a number type. You could use the setup banner that appears when you select the workflow when dragging the for each element onto the workflow but I prefer to precreate my parameters and then link them to the workflow later.
2. Add the for each element to the workflow schema and search for the Change RAM workflow as you described doing in your message
3. On the IN tab of the for each element you should see the Array to Traverse at the top of the tab set to your VMs parameter, if it still says Not Set then you can click on the Not Set link and select your VMs parameter. The array to traverse is the parameter you want the workflow to loop through and increment each time, all other parameters in the workflow will use static values. e.g. your VM value will change each time but the memory value will always be set to 2
4. For the Memory parameter click on Not Set and select your Memory parameter. It should look like this when done:
Now when you execute the workflow it will use the same value for the Memory each time but take the next value from the array of VMs each time, effectively looping through all the VMs in the array updating the Memory.
Hi jvm2016
When you add the for each workflow element and select the workflow you want to use with the loop you have to specify which array the for each element should loop through, all other parameters are then set to a static value.
To do this you want to:
1. In your workflow create input parameters or attributes for the VMs and Memory values. Your parameter for VMs needs to be an array of VC:VirtualMachine type and the Memory parameter needs to be a number type. You could use the setup banner that appears when you select the workflow when dragging the for each element onto the workflow but I prefer to precreate my parameters and then link them to the workflow later.
2. Add the for each element to the workflow schema and search for the Change RAM workflow as you described doing in your message
3. On the IN tab of the for each element you should see the Array to Traverse at the top of the tab set to your VMs parameter, if it still says Not Set then you can click on the Not Set link and select your VMs parameter. The array to traverse is the parameter you want the workflow to loop through and increment each time, all other parameters in the workflow will use static values. e.g. your VM value will change each time but the memory value will always be set to 2
4. For the Memory parameter click on Not Set and select your Memory parameter. It should look like this when done:
Now when you execute the workflow it will use the same value for the Memory each time but take the next value from the array of VMs each time, effectively looping through all the VMs in the array updating the Memory.
thnaks for yur response .
somehow the memory parameter was also prepopulated with type "array." .however as per yur suggestion i am able to do so .