For Each Parallel task
The For Each Paralleltask lets you run other integrations (sub-integrations) from your main integration. As the task name suggests, the sub-integrations run in parallel.
This task uses the API Trigger IDas a handle to identify the integrations to run.
For example, if you specify the API Trigger IDas api_trigger/APITriggerX
, the task runs all the sub-integrations that have
the api_trigger/APITriggerX
trigger ID.
After running a sub-integration, you can also read the response of the sub-integration in your main integration. Use this task to run sub-integrations as dependencies of the main integration.
Before you begin
- Ensure that you have attached a user-managed service account
to your integration. If your integration does not have user-managed service account configured, then by default the default service account
(
service- PROJECT_NUMBER @gcp-sa-integrations.iam.gserviceaccount.com) is used for authentication. - Ensure that your service account has the Application Integration Invoker IAM role. For information about granting roles to a service account, see Manage access to service accounts .
Configure the For Each Parallel task
To configure the For Each Paralleltask:
- In the Google Cloud console, go to the Application Integration page.
- In the navigation menu, click Integrations
.
The Integrations page appears listing all the integrations available in the Google Cloud project.
- Select an existing integration or click Create integration
to create a new one.
If you are creating a new integration:
- Enter a name and description in the Create Integration pane.
- Select a region for the integration.
- Select a service account for the integration. You can change or update the service account details of an integration any time from the Integration summary pane in the integration toolbar.
- Click Create . The newly created integration opens in the integration editor .
- In the integration editor navigation bar, click Tasks to view the list of available tasks and connectors.
- Click and place the For Each Paralleltask element in the integration editor.
- Click the For Each Paralleltask element on the designer to open the For Each Paralleltask configuration pane.
- Configure the displayed fields using the Configuration properties
for the task
as detailed in the tables below.
All changes to the properties are saved automatically.
Configuration properties
This section describes the configuration properties of the For Each Paralleltask.
Input properties
List to iterate
You can pass the iterated value to the sub-integration by setting the Where to map individual array elements field.
You can also pass additional values from the main integration to the sub-integration in the Map to additional sub-integration input(s) field.
API Trigger ID
This value is available in the Trigger IDfield of the API Triggerin the sub-integration.
Execution strategy
SYNC: Runs the sub-integrations in synchronous mode. In this mode, the main integration waits for the sub-integrations to complete before continuing with the downstream tasks.
ASYNC: Runs the sub-integrations in asynchronous mode. In this mode, the main integration does not wait for the sub-integrations to complete. Immediately after calling the sub-integrations, the main integration runs the downstream tasks.
Run all integrations with this API Trigger ID
For example, if integration A
and integration B
, have the same API Trigger ID, both the integrations A
and B
are run for each item in List to iterate
.
Note: If you select this option, the response from the sub-integrations is not be available in the main integration. If you want to use the response of the sub-integrations, select the Run a single integrationoption.
Run a single integration
Where to map individual array elements
Map to additional sub-integration input(s)
- Integration variable to map from : The name of the variable in the current integration to be passed to the sub-integration's input variable.
- Sub-integration input to map to : The name of the sub-integration input variable to map to.
This field takes values in the form of key-value pairs, where the key is a variable in the main integration, and the value is the corresponding input variable in the sub-integration.
For example, consider your main integration has the productID
variable, which you want to map to the subIntProductID
sub-integration variable; you must
select productID
from the Integration variable to map fromfield and enter subIntProductID
in the Sub-integration input
to map tofield.
Collect values from sub-integration output(s)
- Sub-integration output to collect from : The name of the sub-integration output variable to be aggregated.
- Integration variable to collect into : The name of the variable in the current integration to collect the aggregated outputs.
Integrations to execute at a time (parallel)
50
( 10000
maximum). All sub-integrations in a cohort run completely before the next cohort of sub-integrations run.
Ignore failures
You can specify any one of the following values:
- True: Task ignores sub-integration failures and runs all executions.
- False: Task fails for sub-integration failures and ends all executions.
Best practices
We recommend the following best practices when using the For Each Parallel task:
- Set your cohort size based on any quota limitations imposed by your sub-integrations.
- Use a SYNC execution strategy when you want to collect the output of the sub-integration for later use.
- Use an ASYNC execution strategy when your sub-integration might run longer than 2 minutes .
For information about the usage limits that apply to the For Each Parallel task, see Usage limits .
Considerations
In general, do not use a SYNC execution strategy if your sub-integration takes longer than 2 minutes to run or you plan to use this task in conjunction with naturally asynchronous tasks like the Approval task.
Error handling strategy
An error handling strategy for a task specifies the action to take if the task fails due to a temporary error . For information about how to use an error handling strategy, and to know about the different types of error handling strategies, see Error handling strategies .
Quotas and limits
For information about quotas and limits, see Quotas and limits .
What's next
- Learn about all tasks and triggers .
- Learn how to test and publish an integration .
- Learn about error handling .
- Learn about integration execution logs .

