For Each actions

  • Last update on November 6th, 2024

Workflows are not available in the Essentials solution.

 

The “For Each” feature allows you to iterate over a set of input properties, executing a sequence of actions for each item. This feature simplifies repetitive tasks and enhances workflow automation.

This article will guide you through setting up and utilizing the For Each Workflow action, reviewing its output details, understanding its limitations, and appreciating its benefits.

Setting up a For Each Workflow action

Step 1: Add a For Each action

When creating or editing a Workflow,  click on the “Add” button, then select “Add for each” from the dropdown menu.

Select “Add for each” from the “Add” dropdown

Step 2: Add properties

You will be taken to a panel where you can start adding the properties (inputs) on which the For Each action will run. Note that the maximum number of properties accepted is 100. Workflows with over 100 properties will be saved, but you won't be able to run them.

Remember that the limit of 100 inputs in a “For Each” loop does not translate to 100 actions in a Nested Workflow. The maximum number of configurable actions within a Workflow remains at 50. However, the total number of executions depends on the ratio of inputs to actions.

 
Add the inputs (properties) on which the For Each action will run

Step 3: Input methods

You can add properties in four different ways:

  • Typing one input in each field.
  • Typing a list in a single field, separating each input with a comma: a,b,c
  • Typing a list in a single field, within square brackets, each input within quotation marks and separated by a comma: ["a","b","c"]
  • Clicking on the lightning icon and selecting the input from a list of execution inputs you previously created.

You can clear the list by selecting the “Clear For each list” option at the bottom of the wizard.

Way to add For Each properties

Note: Regardless of how you add the inputs, each value (a, b, c, …) remains a separate entity on which the For Each action will be executed.

 

Step 4: Select Nested Workflow

Once you've added all the required properties, press “Save”. 

Press “Save” to continue

This will redirect you to a Workflow wizard where you will be prompted to select an existing nested Workflow to apply.

“For each” Workflow wizard

All For Each Workflows must be Nested Workflows, and this pre-selected setting cannot be edited.

 

Step 4.1: Schedule Workflow start (optional)

You also have the option to schedule the Workflow start in this section by toggling on this function and specifying the number of days of delay. 

“Schedule when workflow starts” option

Step 5: Select execution input

Please note that the execution input field in this panel will only be shown if the execution input of the selected Workflow is marked as required. Simply select the previously specified input from the field dropdown to proceed.

Select “Previously specified input” from the execution input drowpdown

Step 6: Finalize and execute

Save your settings. You have now created your For Each scenario. In the preview you will be directed to, you will see a recap of the properties for which the nested Workflow will be executed.

For Each Workflow preview
  • Clicking on the nested Workflow item will reopen the Workflow wizard.
  • Clicking on the inputs will redirect you to the input setup section.

Make any necessary edits, save, publish, and execute your Workflow.

Reviewing output details

Access execution details

Once the For Each nested workflow has successfully completed its execution, you can review the execution details to collect the outputs. Head to the execution panel and click on “See details” within the “Execute Nested Workflow” section.

Head to the Execution Detail panel and click on “See details”

View execution for each property

This will take you to a “For Each” panel where you can view the execution for each of the selected properties (objects). 

  1. Click on the Workflow icon to open a new execution panel in the center of the screen, displaying the Nested Workflow action executed.
  1. Hover over the Information icon to view the inputs and outputs for the selected option.
  1. Repeat the process for each object.

Note: The output information is only available in this section, and you won't be able to see it when hovering over the information icon next to “Overview” in the same panel.

 

Limitations

  • Action limit: Workflows can contain a maximum of 50 actions. This number includes For Each actions multiplied by the number of properties.
  • Execution inputs: the maximum number of execution inputs in a For Each loop is 100.
  • Parallel executions: the maximum number of parallel executions is 50.
  • Sequential executions: in a For Each condition, executions occur one by one. This means that you can have up to 100 objects in the list of a For Each action.
  • If/Else: If/Else conditions are not supported within For Each actions. For Each actions are not supported within If/Else conditions.

These limitations help optimize the performance and success of your Workflows.

Benefits

The introduction of the “For Each” condition significantly enhances the workflow's adaptability and operational efficiency. For instance, during user onboarding, if you need to add the user to multiple groups, using a “For Each” action within your workflow can automate the assignment process. This eliminates the need for manual tracking and assignment to each group.