---
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


---

# Set Flow Variables flow logic

# Set Flow Variables 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 Set Flow Variables flow logic

TheSet Flow Variablesflow logic enables you to assign values to existing flow variables within a ServiceNow flow.
These variables store flow data as data pills, which you can reference and use throughout the flow.
This functionality is essential for managing and manipulating data dynamically as the flow runs.
Show full answer Show less  

## Key Features

* **Assign Values to Existing Variables:** You can set values using static strings, scripts, or data pills from earlier steps in the flow.
* **Order-Sensitive Assignments:** When referencing other variables in assignments, maintain the order to avoid null values since values are set top to bottom.
* **Supports Inline Scripting:** Toggle scripting on and write scripts to compute variable values dynamically, accessing flow data via the `fddata` object.
* **Flow Variable Access:** Once set, flow variables appear in the Flow Variables section of the Data pane and can be used like any other data pill in subsequent actions.

## Practical Usage

For example, you can check an incident's category and, if it matches a condition (like "network"), assign the incident's record number to a flow variable. This variable can then be used in actions such as sending emails, where it can be included in the subject or body.

You may assign values directly from data pills or via scripts that pull data from the current context. Scripted assignments must return a value and can access flow and action data through `fddata`.

## Important Notes

* Only variables already created in the flow can be assigned values; creating variables is a separate process.
* Assigning a value multiple times to the same variable within a flow will result in only the last assignment being used.
* Leaving the input field empty assigns an empty value to the variable.
* This flow logic does not produce outputs itself but updates the values of flow variables for downstream use.

## Related Flow Logic

The Set Flow Variables logic integrates with other flow logic activities such as Assign Subflow Outputs, Call a Workflow, Make a Decision, and more, enabling complex flow orchestration.  
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.  
Important:  
This flow logic sets values for flow variables that have already been created. For instructions on creating flow variables, see [Create a flow variable](https://www.servicenow.com/docs/x56vJRQd2MZ5IRzs2DfZrA "Create a flow variable to store and retrieve a value throughout a flow.").

## Inputs {#flow-logic-set-flow-variables__section_drb_fdt_jnb}

{#flow-logic-set-flow-variables__table_m4w_ktt_jnb__entry__2}

| Field | Description |
|-|-|
| Name | Name of the variable. Select from the list of variables available for the flow. |
| Data | Value for the variable. Enter a string value, input a script, or use a data pill. Variable values can reference any data pill from earlier in the flow, including other variables. If you set variable values by reference to other data pills, you must maintain the order of the variable assignments. The referenced value must always come before the variable that uses the referenced value. Changing the order may produce null values. To assign an empty value, leave this field empty. Note: Flow variable values are set in the order in which they're assigned from top to bottom. If you set the value of the same variable multiple times, the flow only uses the last value set. To enter a script, select the Toggle scripting on for \[variable\] icon. Enter your script in the script editor. For more information about inline scripting, see [Inline scripts](https://www.servicenow.com/docs/4uIbspkqLERs8ysjXh4fUA "Enable users with coding experience to write inline scripts that set and modify input values during the configuration of an action or flow. Use inline scripts to modify input values that require small format conversions, data transformations, or math operations."). |
[ ]

{#flow-logic-set-flow-variables__table_m4w_ktt_jnb}

## Outputs {#flow-logic-set-flow-variables__section_ipn_gdt_jnb}

This flow logic produces no outputs but does change the value of flow variables.

## Usage {#flow-logic-set-flow-variables__section_my2_bhv_qbc}

Flow variables store flow data as data pills of a specific data type. You can access flow variable data pills from the Flow Variables section of the Data pane. To use a flow variable value, select the data pill from the Data
pane or the pill picker just as you would any other data pill.  

## Set the incident number variable value to a flow data pill value {#flow-logic-set-flow-variables__example_zv1_pdt_jnb}

In this example, the flow checks the category of an incident record. If the category is network, a flow variable is used to store the record number.

Later in the flow, the Send Email action uses the incident number flow variable as part of the email subject and body.

## Set the incident number variable value using a script {#flow-logic-set-flow-variables__example_jmh_z5k_wyb}

In this example, the flow checks the category of an incident record. If the category is network, a flow variable is used to store the record number. In this example, the flow variable is set from a script rather than a data pill
value.  

    /*
    **Access Flow/Action data using the fd_data object. Script must return a value. 
    **Order number is offset by +1 in Error Handling Section.
    **Available options display upon pressing "." after fd_data
    **example: var shortDesc = fd_data.trigger.current.short_description;
    **return shortDesc;
    */
    var incNumber = fd_data.trigger.current.number;
    return incNumber;

## Execution details {#flow-logic-set-flow-variables__section_cql_rdt_jnb}

Figure 1. Execution details for set the incident number variable value to a data pill value Figure 2. Execution details for set the incident number variable value using a script
**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.")
* [For Each flow logic](https://www.servicenow.com/docs/esmLMDyz1JByfBNkIp58zw "Apply one or more actions to each record in a list of records.")
* [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.")
* [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.")

