---
sourceDocument: Yokohama Build workflows
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/build-workflows

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Build workflows

ft:clusterId :

    - crworkflow

bundleId :

    - crworkflow

workflow :

    - Creator


---

# If flow logic

# If flow logic {#ariaid-title1}

Release version: Yokohama  
Updated January 30, 2025  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 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 If flow logic

If flow logic in ServiceNow enables you to selectively execute one or more actions within a flow based on specified conditions related to the current record.
These conditions can be built using record data such as task state or urgency.
Actions or subflows inside the If flow logic only run when the conditions evaluate to true, allowing for precise control over workflow execution.
Show full answer Show less  

## Key Features

* **Conditional execution:** Actions within the If flow logic run only when defined conditions are met.
* **Nested If flow logic:** You can add child If flow logic blocks inside the Then branch of a parent If flow logic to create complex conditional flows.
* **Data pill scope:** Data pill values set inside a Then branch are only available within that branch; referencing them outside results in null values.
* **Condition labels:** Use descriptive labels for condition branches for easier readability.
* **Execution details:** The flow's header shows state, start time, and runtime, and the Configuration Details section displays variable details and runtime values.

## Best Practices

* **Avoid referring to data pill values outside their Then branch** to prevent null values.
* **Group similar condition types together:** Use condition sets to separate AND and OR conditions for the same field to avoid unexpected results.
* **Replace multiple If flow logic blocks with a Make a decision flow logic block:** Use decision tables to handle multiple condition outcomes more efficiently, reducing duplication and simplifying flows.

## Practical Application

For example, you can trigger an action only when an incident has high urgency. Instead of multiple If flow logic blocks for different incident categories, use a Make a decision flow logic block to determine the assignment group, streamlining your workflow design.

## Related Flow Logics

* Assign subflow outputs
* Call a workflow
* Do the following until
* Do the following in parallel
* Dynamic flows
* End Flow
* For Each
* Make a decision
* Set Flow Variables
* Try
* Wait for a duration
* Exit Loop
* Get Flow Outputs
* Go back to
* Skip Iteration  
Selectively apply one or more actions only when a list of conditions is met.  
Use this flow logic by specifying conditions that are based on the current record. Actions or subflows can be added to the flow within the if flow logic. The flow only runs the actions within this flow logic when the conditions evaluate to true. You build conditions based on data in records, such as the value of a task state or urgency.  
Note:  
When you set a data pill value from inside a Then branch of If 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 Then branch from outside of the flow logic branch produces a null value.

## Nested If flow logic blocks {#flow-logic-if__section_ssb_nd1_qzb}

You can add a child If flow logic block to a parent If flow logic block. Add the child If flow logic block to the Then branch of the parent flow logic block.

## Inputs {#flow-logic-if__section_qgk_3gs_r2b}

{#flow-logic-if__table_m3l_b5l_p2b__entry__2}

| Input | Description |
|-|-|
| Condition label | Descriptive label for the conditions of branch. A label can be easier to read than a long or complex condition data pill value. |
| Condition | Conditions under which the branch runs. The flow only runs the contents of the Then branch when the conditions evaluate to true. |
[ ]

{#flow-logic-if__table_m3l_b5l_p2b}

## Outputs {#flow-logic-if__section_cqh_hr1_qzb}

This flow logic has no outputs.  

## Perform an action on if an incident has a high urgency {#flow-logic-if__example_z41_jzw_q1c}

In this example, the action is triggered when the incident record has a high urgency value.

## Execution details {#flow-logic-if__section_wvl_kgs_r2b}

Figure 1. Execution details for if flow logic  
1. The header shows the state, start time, and runtime for the flow logic.
2. The Configuration Details section shows the details about the variables that are used by the flow, including the type, configuration, and runtime values for each variable. Use the <var class="keyword varname">condition</var> variable to see if the branch conditions were met.
{#flow-logic-if__ol_wtt_scs_r2b}

## General guidelines {#flow-logic-if__section_j4w_4pv_q1c}

Use these general guidelines to create effective If flow logic blocks.

Avoid referring to data pill values outside of the Then branch
:   When you set a data pill value from inside a Then branch of If 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 Then branch from outside of the flow logic branch produces a null value.

Group matching condition types in their own condition sets
:   Mixing conditions of different types for the same field values can produce unexpected results. For example, adding an AND condition to a group of multiple OR conditions for an incident short description can produce a
    situation where the If condition never evaluates to true. Use condition groups to group similar condition types for the same field. For example, group all OR conditions for an incident short description in one condition
    set and group all AND conditions for an incident short description in another condition set.  
    Figure 2. Example of grouping matching conditions into condition sets

Replace multiple If flow logic blocks with a Make a decision flow logic block

:   Rather than create duplicate If flow logic blocks that only vary by their conditions, use a decision table to generate an answer. For example, suppose you want to use the incident category to set the assignment group of an incident task record. Rather than create a duplicate If flow logic block for each category value, use the Make a decision flow logic to provide an answer for the assignment group.Here is an example flow that uses
    three If flow logic blocks that each create an incident task record. The only difference between the If flow logic blocks are the conditions of the incident category.

    Figure 3. Example of multiple If flow logic blocks that do the same action

    Here is an example flow that uses a single Make a decision flow logic block to determine the incident task assignment group from the incident category. The Create task action uses the output of the decision as an
    input.  
    Figure 4. Example of replacing multiple If flow logic blocks with a decision

    Here is an example decision table that uses incident record values as an input. The Conditions column consists of two incident category values. The results column consists of the assignment group to use for each
    condition value.  
    Figure 5. Example decision table Get Assignment Group from Category
**Related concepts**   

* [Assign subflow outputs flow logic](https://servicenow-prod.fluidtopics.net/BPYImTV9HJoIPPnwGPh~fg "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://servicenow-prod.fluidtopics.net/qZcmPZCegzFAHnd31j7heA "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://servicenow-prod.fluidtopics.net/eSbS7MMbSBu30a8dSjMBng "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://servicenow-prod.fluidtopics.net/7PJmWFojwFDIqu9dkF7_lw "Run actions and subflows in separate paths within an isolated flow logic block.")
* [Dynamic flows flow logic](https://servicenow-prod.fluidtopics.net/ubno_xW91uUeFZuVIQaySg "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://servicenow-prod.fluidtopics.net/Sp7jPg4NNYSwqRP8XOZouA "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.")
* [For Each flow logic](https://servicenow-prod.fluidtopics.net/sXDICSCto7~hbNZyHxR6lQ "Apply one or more actions to each record in a list of records.")
* [Make a decision flow logic](https://servicenow-prod.fluidtopics.net/Jglm9N3IKaFJ1mfoX8SX3Q "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://servicenow-prod.fluidtopics.net/~PbDvIgeB82CFqu~11nGvQ "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://servicenow-prod.fluidtopics.net/bmLWueso8VCOr_035PJQKg "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://servicenow-prod.fluidtopics.net/ucONIbAnUeCKaCUOpk~Hlw "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**   

* [Exit Loop flow logic](https://servicenow-prod.fluidtopics.net/9FuSmMLS5Ub2t8ypV_xJOQ "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://servicenow-prod.fluidtopics.net/AmvE1SZ0P8d_clYXtrrUgw "Retrieve output values generated by dynamic flows or subflows.")
* [Go back to flow logic](https://servicenow-prod.fluidtopics.net/bhUS9xEo2lNvyY9~JY5mqA "Return to a prior step in the flow to repeat a sequence of actions.")
* [Skip Iteration flow logic](https://servicenow-prod.fluidtopics.net/F2ltfoIaBnP~iH3UFz9hiw "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.")

