The ForEach step is useful when you want to view or manipulate each element in an array which is in a record. The ForEach step iterates over the record array to process each element in the array.
NB: When testing, the steps in the ForEach sub-flow will show only that 1 record has passed to emphasize that it reads one element at a time from the array. When executing, it will show the total number of elements that are in the array.
Illustrated in the below image is an example of a flow of how the ForEach step is used.
The Record Generator is used as a source step to populate data and an array is included in the record as shown in the image below.
The below image is the output of the data that is in the Record Generator.
The ForEach step is then added to process each element in the array. To add the array name in the ForEach step, click on the highlighted icon in the below image.
The below page will appear. The Array Path is the name of the array that is in the record. In this example, “tasks” is the array in the record.
Illustrated in the below image is the output in the ForEach sub-flow. It breaks up each element in the array to process it by becoming separate records.
The output outside of the ForEach sub-flow is the original record as shown in the below image.