When you're creating scripts, "for each" loops let you iterate over a list of input items. During iterations, the inner actions for each item in the list are executed.
Watch this quick screencast for a scenario applicable to the steps you'll take below.
Click here for more videos.
Set Up the For Each Loop
Start Creating a For Each Loop. Select For each in the Main Workflow drop-down list.
Add Items to an Iteration. Type text or use JSON to add items to your iterations.
Obtain Data from an Iteration. When you click Data, note that ForEach Context is included in the Source field.
The Current iteration returns a number and Current item the value of the current iteration.
The dark green CurrentItem, shown below, is created when you select ForEach Context above.
Create an Inner Loop. Optionally, create inner loops, as shown below.
When you have multiple for each loops, the Pick for each field lets you select the for each loop you need.