PROCESIO
OverviewPlatform ActionsIntegrations & DemosMarketplaceCustom ActionsDeveloper’s Guide

For Each

Runs the actions inside its border once for every item of a list, so you can process each row or element on its own.

For Each runs the actions placed inside its border once for every item of a list. Use it to process the rows of a file, the results of a query or the emails read from a mailbox one by one. Inside the border, a local variable (the iterator) holds the current item.

Add the action

In the Process Designer toolbox, pick For Each (or type For Each in the search box). When you drop it on the canvas it expands into a bordered area: everything inside the border runs once per item.

The For Each action properties: In List, For Each Item and Action timeout

Inputs and outputs

FieldDirectionTypeRequiredWhat to put / what you get
In ListInputList (any type)YesThe list to go through. Pick a process variable that is a list.
For Each ItemOutputSame type as the list itemsYesThe name of the local variable that holds the current item. Type a new name, for example iterator, and use it in the actions inside the border.
Action timeoutInputIntegerYesThe maximum number of seconds the whole loop may run. 0 means no limit.

Example: send one email per contact

This process goes through a list of contacts and sends each one an email.

Step 1: Drag For Each onto the canvas.

The For Each action on the canvas

Step 2: In the Process Variables (X) panel, create an input variable inputData, a list of the data model clientDetails (attributes email, name, body, all text).

Creating the inputData list variable

Step 3: Configure the For Each properties.

The For Each properties panel

  1. In In List, select inputData.

    Selecting inputData in In List

  2. In For Each Item, type iterator. This local variable is what the actions inside the border use.

    Naming the iterator in For Each Item

  3. Set Action timeout, or leave 0 for no limit.

Step 4: Inside the border there is a Start point. Drag an action from the toolbox into the border and connect it to the Start point.

Actions connected inside the For Each border

Step 5: Add a Send Email action inside the border and use the iterator's attributes, for example the iterator's email attribute in To and its body attribute in Body.

Send Email inside the For Each border

The Send Email configuration using the iterator variable

Step 6: Save, Validate and Run the process, and give values to the list.

Running the process with values for the list

The For Each goes through every contact in the list and sends a separate email to each.

Good to know

  • The items are processed one after the other, in list order, not in parallel.
  • An empty list skips the actions inside the border; the process continues after the For Each.
  • Action timeout covers the whole loop, not one iteration. The time is checked at the start of each iteration: when it has run out, the step fails with "Foreach timeout exceeded!". The iteration already running is not interrupted.
  • Inside the border you can add any action except Start and Stop. A Stop would end the whole process after the first item, so it cannot be placed inside a loop.
  • Use the iterator (the For Each Item name) inside the loop, not the list variable itself. After the loop ends, the iterator is reset.
  • For Each cannot be run with Test Action; run the whole process to try it.

Tips for the canvas

  • To make room for more actions, resize the border by dragging its bottom-right corner.
  • Make sure there is enough free space on the canvas for the border to expand; move other actions if needed.

On this page