Flows/Utilities/Iterators/Array Iterator

Iterator

Loop through array items and execute nodes for each

Overview

The Array Iterator utility takes an array and outputs each item as a separate bundle. This allows you to process each item individually through subsequent nodes in your flow.

Think of it as a forEach loop - the flow after the iterator runs once for each item in the array.

Configuration

Array

The array to iterate over. Use templates to reference arrays from previous nodes.

{{#1.data.items}}

Output

For each item in the array, the iterator outputs a separate bundle. The output structure depends on the array element type:

For object elements:

Object properties are spread directly onto the bundle, making them accessible at the top level.

// Array: [{name: "John", email: "john@example.com"}, ...]
// Bundle output:
{
  name: "John",
  email: "john@example.com",
  bundleOrderPosition: 1,
  totalNumberOfBundles: 50
}

For primitive elements (strings, numbers):

The value is wrapped in a value property.

// Array: ["apple", "banana", "cherry"]
// Bundle output:
{
  value: "apple",
  bundleOrderPosition: 1,
  totalNumberOfBundles: 3
}

Metadata fields (always included):

  • bundleOrderPosition - 1-based position in the array (1, 2, 3...)
  • totalNumberOfBundles - Total number of items in the array

Examples

Example 1: Process API Results

An API returns a list of users. Process each user individually:

Array:{{#1.data.users}}

Each bundle contains the user object fields directly:

// Access in subsequent nodes (if iterator is node #2):
Email: {{#2.email}}
Name: {{#2.name}}
Position: {{#2.bundleOrderPosition}} of {{#2.totalNumberOfBundles}}

Example 2: Process String Array

Iterate over a list of file URLs (primitive strings):

Array:{{#1.data.fileUrls}}

Since array contains strings, access via value:

// Access in subsequent nodes (if iterator is node #2):
URL: {{#2.value}}
Position: {{#2.bundleOrderPosition}}

Example 3: Progress Tracking

Use bundle metadata to track progress:

Processing item {{#2.bundleOrderPosition}} of {{#2.totalNumberOfBundles}}
Current user: {{#2.name}}

Note: bundleOrderPosition is 1-based (starts at 1, not 0).

Tips

Tip: Use Array Aggregator after processing to collect all results back into a single array.

Tip: Use Bundle Limit before the iterator during development to test with fewer items.

Note: Large arrays can generate many executions. Consider using Bundle Limit to prevent runaway processing.

Array Iterator Utility - Flows Guide - Serenities