Parallel ForEach Item

Usage

The "Parallel ForEach Item" action in the Control Flow category for Zenphi allows you to perform a set of actions for each item in a collection simultaneously. This action is particularly useful when you need to process multiple items quickly and independently.

If your operations involve numerous steps or require detailed logging, it is better to use a simple ForEach loop. Offload these operations to another flow triggered through an HTTP trigger within the loop. This approach provides better control, manageability, and logging capabilities.

Fields

  1. Collection
    This field specifies the collection of items to be processed in parallel. A collection can be a list of objects, strings, numbers, or any other iterable dataset in your workflow. For example, you can use a list of email addresses to perform parallel actions like sending notifications to each recipient. The collection must be defined earlier in the workflow and referenced here.

Demonstration on how to use it in a flow

1.Drag and drop Parallel ForEach Item action into the flow.

2.The Name section is pre-filled by the action name but you can configure this section according to your preference.

3.Click the gear icon to open its settings.


  1. Specify the collection of items you want to process in parallel. For example, if you have a list of tasks to assign or email addresses to notify, use this collection as the input. First, ensure the collection is defined in a previous step of your workflow, such as retrieving a list of tasks from a database or a list of users from a directory. Then, input the name of the collection into the Collection field.
  2. After configuring the collection, place the actions you want to execute for each item inside the "Parallel ForEach Item" block. For instance, if you are sending emails to a list of recipients, include a "Send Email" action and configure it to use the current item from the collection as the recipient.

Conclusion

The "Parallel ForEach Item" action is a powerful tool for processing multiple items simultaneously, helping to speed up workflows that involve independent tasks. By defining a collection and executing actions in parallel, you can enhance efficiency and reduce the overall processing time. However, for complex operations or when detailed logging is required, using a simple ForEach loop with an external flow is recommended.