For each
Function: For each
This action allows you to automate repetitive tasks by performing a specific action for every item in a list or collection of data. It's like telling the platform, "For each item in this group, do this specific thing." This is incredibly useful for processing multiple records, sending individual notifications, or updating several entries at once.
Input
- List: The collection of items you want to process. This could be a simple list of values, a page of data records from your database, or a set of key-value pairs. (Required)
- Limit: An optional number that specifies how many items from the beginning of the list you want to process. If you have a list of 100 items but only want to process the first 10, you would set the limit to 10. (Optional)
- Item name: A unique name you give to each individual item as it's being processed. This name acts as a temporary placeholder, allowing the action you're repeating to refer to the "current item" in the list. For example, if your list contains "Customers," you might name each item "Current Customer." (Required)
- Action: The specific action you want to perform for each item in your list. This could be any other action you've built in the platform, such as sending an email, updating a record, or creating a new entry. (Required)
- Action parameters: The specific inputs required by the
Actionyou selected. These parameters can use theItem nameyou defined to access details of the current item being processed. For example, if your action sends an email, anAction parametermight be "Recipient Email" and you could set its value toCurrent Customer.EmailAddress.
Output
- Action outputs: The results or data produced by the
Actionthat was executed for each item. These outputs can be collected and used later in your workflow.
Execution Flow
Real-Life Examples
Example 1: Sending personalized welcome emails to new users
Imagine you have a list of new users who signed up today, and you want to send each of them a personalized welcome email.
- Inputs:
- List: A list of "New Users" (e.g., retrieved from a database query).
- Limit: (Leave blank) - Process all new users.
- Item name:
CurrentUser - Action: "Send Welcome Email" (a pre-configured action that sends an email).
- Action parameters:
Recipient Email:CurrentUser.EmailAddressSubject: "Welcome to our platform,CurrentUser.FirstName!"Body: "DearCurrentUser.FirstName, thank you for joining..."
- Result: The platform iterates through each new user in the list. For every
CurrentUser, it triggers the "Send Welcome Email" action, populating the email address, subject, and body with the specific details of that user. Each user receives a personalized welcome email.
Example 2: Updating inventory status for multiple products
Suppose you've received a new shipment and need to update the "In Stock" quantity for several products in your inventory.
- Inputs:
- List: A list of "Shipped Products" (e.g., imported from a spreadsheet, where each item has
ProductIDandQuantityReceived). - Limit: (Leave blank) - Update all products in the shipment.
- Item name:
ProductUpdate - Action: "Update Product Inventory" (an action that takes a product ID and a quantity to add).
- Action parameters:
Product ID:ProductUpdate.ProductIDQuantity to Add:ProductUpdate.QuantityReceived
- List: A list of "Shipped Products" (e.g., imported from a spreadsheet, where each item has
- Result: The platform goes through each
ProductUpdatein your "Shipped Products" list. For each one, it executes the "Update Product Inventory" action, adding theQuantityReceivedto theProductID's current stock level. Your inventory records are automatically updated for all shipped items.
Example 3: Generating reports for the top 5 sales regions
You want to quickly generate a summary report for only your top 5 sales regions based on last month's performance.
- Inputs:
- List: A list of "Sales Regions" (e.g., retrieved from a database, sorted by sales performance in descending order).
- Limit:
5- Process only the first 5 regions. - Item name:
TopRegion - Action: "Generate Sales Report" (an action that creates a PDF report for a given region).
- Action parameters:
Region Name:TopRegion.NameTime Period: "Last Month"
- Result: The platform processes only the first 5
TopRegionentries from your sorted list. For each of these top regions, it runs the "Generate Sales Report" action, creating a specific sales report for that region for "Last Month."