When to Use Iterator
Understanding Iterator
Iterator expects an array as input. It then:- Takes the first item from the array
- Runs all actions inside the Iterator with that item
- Moves to the next item
- Repeats until all items are processed
Selecting the array to loop over
Most array sources (Search Records, a webhook array field, a Bulk manual trigger) can be selected directly in the variable picker. When a Code or Logic Function step returns a top-level array, its output appears in the variable picker as indexed entries (0, 1, 2, …). To loop over the array as a whole, select the Whole list option for that step — the Iterator then infers the shape of each item from the list automatically.
Basic Setup
Example: Email Everyone in Search Results
Goal: Find all contacts in a specific company and send each one a personalized email.Step 1: Search for Records
- Add Search Records action
- Object: People
- Filter: Company equals “Acme Inc”
- This returns an array of people
Step 2: Check Results Exist
- Add Filter action
- Condition:
{{searchRecords.length}}is greater than 0 - This prevents Iterator errors on empty results
Step 3: Add Iterator
- Add Iterator action
- Array input: Select
{{searchRecords}} - This creates a loop
Step 4: Add Actions Inside Iterator
Actions placed after Iterator run for each item:- Add Send Email action (inside Iterator)
- To:
{{iterator.currentItem.email}} - Subject: Hello
{{iterator.currentItem.firstName}}! - Body: Personalized message using current item fields
Result
If Search Records returns 5 people, the Iterator:- Sends email to person 1
- Sends email to person 2
- … continues for all 5
Accessing Current Item Data
Inside Iterator, use{{iterator.currentItem}} to access the current record:
In the variable picker, you can either drill into a specific field of the current item, or pick Use the whole item to reference the entire current item (
{{iterator.currentItem}}). Selecting the whole item is handy when you want to pass a full record straight into a downstream step rather than rebuilding it field by field.
Common Patterns
Update Multiple Records
Goal: Mark all overdue tasks as “Late”Create Records from Array
Goal: Webhook receives order with multiple items, create a record for eachConditional Processing Inside Loop
Goal: Only send email to contacts with valid emailsTroubleshooting
”Iterator expects an array”
Cause: You passed a single record instead of an array. Fix: Make sure you’re passing the result of Search Records or an array field, not a single record.Iterator Doesn’t Run
Cause: The array is empty. Fix: Add a Filter before Iterator to check array length:Actions Run Too Many Times
Cause: Search Records returned more records than expected. Fix:- Add more specific filters to Search Records
- Set a limit on Search Records (max 200)
- Add Filter inside Iterator for additional conditions
Performance Considerations
- Credit usage: Each iteration consumes credits for its actions
- Time: Large arrays take longer to process
- Limits: Consider batching very large operations
- Rate limits: External API calls may hit rate limits with many iterations
Best Practices
- Always check array length before Iterator to avoid errors
- Add filters inside loops when not all items need processing
- Rename your Iterator step to describe what it’s looping through
- Test with small arrays before processing large datasets
- Monitor workflow runs to ensure iterations complete as expected