Loop Node

The Loop Node repeats a sub-workflow for each item in an input array.

It enables batch actions and powerful automation for lists of data.

Purpose

  • Processing List Items: Run steps for each item in a collection (e.g., process each order).
  • Data Enrichment: Fetch or transform additional info for each array item.
  • Batch Operations: Perform actions like sending multiple emails or creating many records.

Configuration

Configurable properties:

PropertyTypeDescriptionDefault
labelstring (optional)Descriptive name for the node instance.'Loop'
inputArrayPathstring (optional)Path to the array in input data (dot notation or JSONPath).''
Input Array Path Syntax

Important: Specify the inputArrayPath syntax:

  • Path Language: Dot notation (orders) or JSONPath ($.orders).
  • Validation: If the path is invalid or not an array, define whether to show error, skip, or run loopEnd only.
  • Examples:
    • orders for "orders": [...]
    • customer.details.tags (for nested arrays)

Inputs and Outputs

Input (Left Handle, id: "input"):
Receives the object with the array to process.

Outputs:

  • loopBody (Right Handle, id: "loopBody"):
    Triggered for each item in the array found at inputArrayPath.
    Data: The individual item (optionally, index/context depending on implementation).

  • loopEnd (Right Handle, id: "loopEnd"):
    Triggered once after all items are processed or immediately if array is empty.
    Data: The original input data (optionally, aggregated results).

Iteration Logic

  1. Data arrives at the input handle.
  2. Node resolves inputArrayPath to find the array.
  3. If inputArrayPath is invalid or not an array:

    • Define: show error, skip, or just trigger loopEnd.
  4. If the array is empty:

    • loopBody not triggered.
    • loopEnd triggered immediately.
  5. If array has items:

    • For each item, trigger loopBody, passing the current item.
    • After all, trigger loopEnd (optionally, after sub-workflows finish).
Execution Model

Synchronous (sequential) vs. asynchronous (parallel) loop execution changes workflow results—clarify in docs for your engine.

Example: Sending Welcome Emails

Input Data Example:

{
"newUsers": [
  { "name": "Alice", "email": "alice@example.com" },
  { "name": "Bob", "email": "bob@example.com" },
  { "name": "Charlie", "email": "charlie@example.com" }
]
}

Node Configuration:

  • label: Email New Users
  • inputArrayPath: newUsers

Workflow Connections:

  • loopBody connects to:

    1. Transform Node to format an email using name and email.
    2. HTTP Request Node to send the email.
  • loopEnd connects to:

    • Notification Node (when all done), or Logging Node.

Execution:

  • loopBody runs 3 times:
    • First: Alice,
    • Second: Bob,
    • Third: Charlie.
  • After last email, loopEnd is triggered.

Notes and Considerations

  • Performance: Large arrays with slow or complex loopBody flows can slow the workflow. Consider batching or async patterns.
  • Error Handling: Define what happens if an error occurs in one iteration (continue, stop, or collect errors).
  • Aggregation: If you want to collect results from all items, handle it via downstream logic after loopEnd.

The Loop Node unlocks repetitive automation for any data list in your flows.

Loading search features...