> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.meetgail.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.meetgail.com/_mcp/server.

# For Each

> Runs a set of steps once for every item in a list.

The For Each node repeats a group of steps for every item in a list. You give it
a list and build the steps that should run for each one; inside those steps you
can read the current item and its position. It is how a workflow processes many
records in a single run.

## When to use it

* You want to do real work for each item in a list, such as calling a service or
  running an AI step for every contact.
* You want each item handled in its own isolated pass, so one item's work does
  not bleed into the next.
* You are processing a large list in pieces and want to keep memory in check.

If each item only needs a data reshape rather than its own steps, use
[Map](/platform/workflows/node-reference/logic-and-flow/map), which is lighter.

## Inputs

| Field           | What it's for                                                                                        | Example                                        |
| --------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| Collection      | The list to loop over, usually produced by an earlier step.                                          | A list of policyholders to process             |
| Steps           | The set of steps that run once per item. Inside them you can read the current item and its position. | Look up each policyholder, then log the result |
| Collect results | Turn on to gather each pass's result into a list you can read afterward. Leave off for large loops.  | On, when a later step needs every result       |

## Outputs

| Field   | What you get back                                                        |
| ------- | ------------------------------------------------------------------------ |
| Count   | How many items were processed.                                           |
| Results | Each pass's result, when Collect results is on. Otherwise this is empty. |
| Success | Whether every pass completed without a failure.                          |

## Example

An agency needs to enrich a list of policyholders one at a time. A For Each node
loops over the list, and for each person its inner steps prepare a clean record
and run an AI classification. The loop runs in order, one policyholder after
another, so Sarah Chen is fully processed before Marcus Johnson begins. Because
no later step needs the combined output, Collect results stays off to keep the
run lean.

![The For Each node configuration panel, showing the collection to loop over and the collect-results option.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/gail.docs.buildwithfern.com/a663bcdc731c14c2e4b7af5e6e9193359ff9d470726d90aec3b5ab313bd8be48/docs/pages/platform/workflows/assets/logic-and-flow-for-each.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260823%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260823T232923Z&X-Amz-Expires=604800&X-Amz-Signature=d21c7ef6002dc2e46f0cd8f3b201d11930decc922fe1af43e0a30207d80312ca&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

Leave Collect results off unless a later step actually needs every pass's
output. Gathering results from a long loop can grow large fast; when it is off,
each pass is still visible in the run history.

## Related nodes

#### [Map](/platform/workflows/node-reference/logic-and-flow/map)

Reshape every item in a list without running full steps for each one.

#### [Sub Graph](/platform/workflows/node-reference/logic-and-flow/sub-graph)

Package a group of steps into a single reusable unit.