Within the toolbox there are a group of tools that help to control the direction and flow of the workflow.
What is the Each tool used for?
The Each tool is used as a way of looping through a list of items in a collection variable to perform an action. When added to the workflow canvas, it adds an output to a step called Execute for each.
To move on from the loop, you can have a Start step tool that points to a When step that waits for the last thing to complete, as shown below.

Pre-Requisites
List of items - Before using the Each tool, you need to have retrieved your list of items to be looped through and placed them in a collection variable.
Configuration
Source Collection | The list variable that contains the items you want to list through. |
Current Item Variable | The item that is currently selected in the list. This can then be used in the resulting action. For example, if looping through a list of witness IDs, the witness ID that is currently being dealt with can be used as the 'To' party for the telephone call. |
Best Practice using Each … When tools
The workflow When tool is good for re-joining all the threads in a workflow, e.g., from an Each or multiple Start steps. When using Each … When tools in a workflow, you must follow these guidelines to avoid unexpected outcomes or errors.
- If there are multiple steps between an Each and the When, it could be a problem.
- If there are multiple Each actions, this will be a problem.
In short the best approach is to have a single Step after the Each, if this is not possible, then consider moving the logic into another workflow and using the Start workflow action.
Here's an example of bad Each and When usage. This could be resolved by merging into a single block or extracting the section into another workflow.
