If you want to run a subworkflow multiple times by passing different values for its parameters or variables in every subsequent run, you can insert a Foreach element in the parent workflow.
When you insert a Foreach element, you must select at least one array over which the Foreach element iterates. An array element can have different values for each subsequent workflow run.
If the subworkflow has output parameters, you must select the output parameters of the Foreach element in which to accumulate workflow outputs, so that the subworkflow can iterate over them as well.
Procedure
Results
You defined a Foreach element in your workflow. The Foreach element runs a workflow that takes as parameters every element from the array of parameters or variables that you have defined.
For parameters or variables that are not defined as arrays, the workflow takes the same value in every subsequent run.
Example: Rename Virtual Machines by Using a Foreach Element
You can use a Foreach element to rename several virtual machines at once. You have to insert a Foreach element in a workflow and promote the vm and the newName parameters as input to the current workflow. In this way, when you run the workflow, you specify the virtual machines to rename and the new names for the virtual machines. The virtual machines are included as elements in the array that you created for the vm parameter. The new names for the virtual machines are included in the array that you created for the newName parameter.