studio-web
latest
false
- Release notes
- Getting started
- For administrators
- RPA workflow projects
- Creating an RPA workflow from an idea
- Creating a project
- How to start an RPA workflow
- Managing project files and folders
- Connecting RPA workflows to your accounts
- Configuring activities
- Managing the activities in a project
- Passing values between activities
- Iterating through items
- Managing the data in a project
- Configuring a project to use your data
- Using file and folder resources
- App projects
- Agentic processes
- Agents
- Solutions - Preview
- API workflows - Preview

Studio Web User Guide
Last updated Sep 22, 2025
For Each
linkThe For Each activity iterates over arrays and executes a defined set of steps for each array element. Use the For each activity to handle API responses containing object arrays, such as lists of users, orders, or records that require individual processing.
How to aggregate data in an array
linkA common use case for the For Each activity is aggregating data from multiple API calls into a structured array using the Script activity.
The For Each activity automatically collects the output of the last activity within its Body flow, and compiles it into an array available in its own output.
Using the For Each activity
linkTo add a For each activity to your workflow:
- On your API workflow designer canvas, select the plus (+) icon. The Add activity menu appears.
- Select Loop, then ForEach.
- In the Properties panel, configure the following fields:
- In—Use the Expression editor to specify the array for iteration. Usually, this array comes from a previous API response.
- Item name—Assign a reference name for array elements (default is
currentItem
). Use this reference to access each item during iteration. - Acumulate result—Turn it on to collect the output of each iteration into a single results array, which you can access later in your workflow.
- In the Body of the ForEach loop, add the activities to process the array items.
- Add activities to the Then and Else branches as needed.
- Test the workflow to execute the activity and generate output fields for later use.
For Each activity example
linkThe following example iterates over an array of employee objects, combines the first and last names of each employee, and
returns the aggregated results in a structured response.
Open the Debug configuration window, then paste and save the following JSON syntax:
{
"employees": [
{
"first_name": "Bobbie",
"last_name": "Draper",
"position": "administration",
"email": "[email protected]"
},
{
"first_name": "James",
"last_name": "Holden",
"position": "manager",
"email": "[email protected]"
}
]
}
{
"employees": [
{
"first_name": "Bobbie",
"last_name": "Draper",
"position": "administration",
"email": "[email protected]"
},
{
"first_name": "James",
"last_name": "Holden",
"position": "manager",
"email": "[email protected]"
}
]
}
- On your API workflow designer canvas, add a For Each activity.
- Configure the For Each fields as follows:
- In—Use the Expression editor to reference the
employees
array from the run configuration:$workflow.input.employees
$workflow.input.employees - Item name—Assign a reference name for array elements (default is
currentItem
). Use this reference to access each item during iteration.
- In—Use the Expression editor to reference the
- In the Body of the For Each loop, add a Script activity.
- For the Script activity, use Expression editor to create a JSON that combines the
first_name
andlast_name
properties into an object:return { "name": $currentItem.first_name + " " + $currentItem.last_name }
return { "name": $currentItem.first_name + " " + $currentItem.last_name } - Save the configuration.
- At the end of the workflow, add a Response activity.
- Configure the response as follows:
- Type—Success
- Details—Open the Expression editor and write the following:
$context.outputs.For_Each_2
$context.outputs.For_Each_2
- Test the workflow to execute the activity.
- Check the Output panel to review the response.