---
sourceDocument: Brazil Build workflows
sourceDocumentLink: https://www.servicenow.com/docs/r/build-workflows

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Build workflows

ft:clusterId :

    - crworkflow

bundleId :

    - crworkflow

workflow :

    - Creator


---

# For Each flow logic

# For Each flow logic {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of For Each flow logic

The For Each flow logic in ServiceNow enables you to apply one or more actions to each record within a list of records sequentially.
This is useful for processing multiple records individually within a flow.
However, data pills set inside a For Each branch are only accessible within that branch and cannot be referenced outside it.
Show full answer Show less  
Because iterating over many records can be resource intensive---especially with complex actions---it is recommended to manage performance by disabling reporting through the **com.snc.processflow.reporting.level** system property if necessary.

## Inputs and Outputs

* **Inputs:** The input is a list of records (Sys ID values or Records data pill), which you can generate using actions like Look Up Records. To ensure records are processed in a specific order, sort the list before passing it to the For Each logic (e.g., using the Order by option in Look Up Records).
* **Outputs:** The flow outputs the current record in the loop for each iteration. By default, execution details are stored only for the first and last iterations, but you can configure flow execution settings to capture details for all iterations.

## Practical Example

A common use case is sending an email for each configuration item potentially affected by a change request. The flow starts on change request creation, uses Look Up Records to find related Configuration Items, and then uses For Each flow logic to send an email per configuration item. This demonstrates how the output list drives the iteration, and flow execution logs show the record processed in each loop iteration.

## General Guidelines

* **Limit list size:** Avoid processing more than 1000 items in a single For Each loop to optimize performance. For larger lists, divide records into smaller segments and use multiple flows.
* **Flow stages:** You cannot define stages inside a For Each block---stages can only be placed before or after it.
* **Avoid nested loops:** Nested For Each loops can cause flows to exceed the transaction quota (flow runtime limit of one hour), potentially stopping execution prematurely.

## Key Considerations for ServiceNow Customers

When designing flows that process multiple records, use For Each flow logic to handle individual record actions efficiently, but carefully manage list size and avoid complex nested loops to maintain flow performance and reliability. Sorting and preparing your input list ensures predictable processing order. Also, configure flow execution settings if detailed iteration logs are needed for monitoring or auditing.  
Apply one or more actions to each record in a list of records.  
The For Each flow logic applies one or more actions to a list of records. The flow applies the actions contained within the flow logic to each record in the list.  
Note:  
When you set a data pill value from inside a For each item branch of flow logic, the data pill value is only available to other actions in the same branch. Referencing a data pill value that was set inside a For each branch from outside of the flow logic branch produces a null value.

Iterating over a large number of records can be resource intensive, especially when the For Each logic block includes complex actions for each iteration. To avoid performance issues, turn off reporting using the com.snc.process_flow.reporting.level system property. For more information, see [Workflow Studio flow system properties](https://www.servicenow.com/docs/ZiSrhpPWhOmNQ3gHe2io5A "Configure how the system processes flows.").

## Inputs {#flow-logic-for-each__section_tyr_cxk_r2b}

Items
    : Data type: Records  
    List of Sys ID values or Records data pill specifying the records to process in sequence. You can use a Look Up Records action to generate a list of records. For more information, see [Look Up Records action](https://www.servicenow.com/docs/v5NROTOREvNTjGmJFJHPrQ "Look up multiple records on any table using defined conditions.").  
    Note:  
    If you want to process items in a particular order, you must first sort the items in this input in advance. For example, use the Order by option to sort the results of a Look Up Records action.

## Outputs {#flow-logic-for-each__section_vxs_gzk_r2b}

\[Table name\] Record
:   Data type: Record  
    Current record in the loop.  
    Note:  
By default, all flow loops only store execution details for the first and last iterations of a loop. To report on all iterations of a loop, create a flow execution setting record for each flow that you want to collect loop execution details. For more information about flow execution settings, see [Flow execution settings](https://www.servicenow.com/docs/8IjCrTS8PCwTTdwPheaHkQ "Specify the runtime settings for an individual flow, subflow, or action such as the run priority, reporting level, and logging level.").  

## Send an email for each configuration item potentially affected by a change

This example flow starts when a change request record is created. The flow uses a Look Up Records action to find Configuration Item records assigned to the requester of the change request. The flow uses For Each flow logic to
send an email about each configuration that might be affected by the change request. The output of the Look Up Records action contains the list of records to process.

The flow execution details show the configuration item record used for each iteration of the loop.

## General guidelines {#flow-logic-for-each__section_vkq_bcs_tbc}

Use these general guidelines with a For Each flow logic.

Avoid adding more than 1000 items
:   Avoid iterating over lists with more than 1000 records. Keep your list of records smaller to optimize flow performance. To iterate over lists with more than 1000 records, divide the list into smaller sections and use
    multiple flows.

Avoid defining stages that depend on a For Each flow logic
:   Flow Designer prevents you from adding stages within a For Each block. You can only add stages before or after a For Each block.

Avoid nested For Each loops
:   Avoid nested For Each loops that process many records. Nested loops may cause the flow to run until it is stopped by the flow transaction quota rule, which prevents flows from running longer than an hour. For more
    information about transaction quotas, see [Transaction quotas](https://www.servicenow.com/docs/access?context=c_TransactionQuotas&version=brazil&pubname=brazil-platform-administration&ft:locale=en-US).
**Related concepts**   

* [Assign subflow outputs flow logic](https://www.servicenow.com/docs/qX27EulT5kOBRGKBYxAG8A "Specify the data the subflow returns when it completes running. Use subflow output as data for a parent flow or as input for another process.")
* [Call a workflow flow logic](https://www.servicenow.com/docs/NQEIJIgXEakKk3tuRLtZPw "Run a published and active workflow from your flow. You can use the flow data as a workflow input. For example, you can specify the current record as a workflow input.")
* [Do the following until flow logic](https://www.servicenow.com/docs/ovrNT5MVtXPVysCc2ZtXzw "Apply one or more actions repeatedly until an end condition is met. You can use the flow data to specify the end conditions.")
* [Do the following in parallel flow logic](https://www.servicenow.com/docs/fHNODu_WWcW9BSU~UR9nUw "Run actions and subflows in separate paths within an isolated flow logic block.")
* [Dynamic flows flow logic](https://www.servicenow.com/docs/UPiveOIQepWbt3_pM56DDQ "Identify and run a flow or subflow dynamically by using runtime data. Build templates to provide expected inputs for dynamically called flows or subflows.")
* [End Flow flow logic](https://www.servicenow.com/docs/yoHSXT_u6_hZ~2BZ7Vs2sQ "Stop running the current flow. Use End Flow within a branch of the flow to specify an exit condition. For example, end the flow when it reaches a specific If flow logic block.")
* [If flow logic](https://www.servicenow.com/docs/DdLyuPtduXTkT6w~M7dtvg "Selectively apply one or more actions only when a list of conditions is met.")
* [Make a decision flow logic](https://www.servicenow.com/docs/8NnG8rZdZCenxcQACsoXIQ "You can use the decision table branching logic in situations where multiple conditional paths are required, as an alternative to nested If, Else If, or Else flow logic. For example, if you want to determine what kind of car insurance you need, you can add inputs such as your age, accident history, and car model to the decision table to determine a level of insurance coverage. This logic can save you time and present a more readable format than nested if conditions or switch case statements.")
* [Set Flow Variables flow logic](https://www.servicenow.com/docs/pznT35Am0Xun~TcL09vXNg "Assign a value to one or more flow variables, which store flow data as data pills. Access flow variable values by referring to their data pill.")
* [Try flow logic](https://www.servicenow.com/docs/EfEGiwtJuz7RzLyjvwwBJA "Allow a flow to continue running when an error occurs within a flow logic block. Run a sequence of actions in response to errors within the flow logic block.")
* [Wait for a duration flow logic](https://www.servicenow.com/docs/2GOH3wSHrDcPpajWzQTdAg "Use this flow logic to give your users time to act during automated processes or to wait for a specific date and time to complete actions.")  
**Related reference**   

* [Append to Flow Variables flow logic](https://www.servicenow.com/docs/JlnmAl1y4IYNT_kgYbTTBg "Append a value to one or more array of objects flow variables. Use flow data to generate values.")
* [Exit Loop flow logic](https://www.servicenow.com/docs/IGMuJBwBeRK~eUyPdIpFIQ "Exit from a flow logic loop when the conditions of an If flow logic are met. Continue running the flow from the next step after the flow logic loop. This flow logic is also known as break.")
* [Get Flow Outputs flow logic](https://www.servicenow.com/docs/fXxlC3vf5PmIAASLlaHC7w "Retrieve output values generated by dynamic flows or subflows.")
* [Go back to flow logic](https://www.servicenow.com/docs/GrCZOQpQWRJoTNdB39tF2Q "Return to a prior step in the flow to repeat a sequence of actions.")
* [Skip Iteration flow logic](https://www.servicenow.com/docs/fvFzdxlhfu7NJl3i~niFcQ "Skip the current iteration of a flow logic loop when the conditions of an If flow logic are met. Continue running the flow logic loop with the next item in the list. This flow logic is also known as continue.")

