Flow variables

  • Release version: Australia
  • Updated March 12, 2026
  • 2 minutes to read
  • Summarize
    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 Flow Variables

    Flow variables in ServiceNow allow users to create and modify variables directly within a flow. These variables can be accessed as data pills in the Data panel and are used to set and retrieve values throughout the flow, functioning similarly to subflow inputs and outputs but with broader accessibility.

    Show full answer Show less

    Key Features

    • Creation: Flow variables can be created via the More Actions menu, allowing multiple variables to be defined at once by selecting their names and data types.
    • Assignment: Values can be assigned to flow variables using the Set Flow Variables logic. This feature allows for the assignment of multiple variables' values in one action, with the ability to change these values as needed.
    • Mutable Values: Unlike other data pills, flow variable values are mutable and can be updated. If no value is assigned, the default is null.
    • Order of Assignment: The order of value assignments matters; only the last value assigned to a variable will be used during execution.
    • Referencing: Variable values can reference other data pills, but the order must be maintained to avoid null values.
    • Execution Details: After executing the Set Flow Variables logic, a summary is provided detailing variable names, types, configurations, and runtime values.
    • Supported Data Types: Flow variables can utilize various data types, including Array, Object, Date/Time, Decimal, Integer, and more.

    Key Outcomes

    By effectively utilizing flow variables, ServiceNow customers can enhance their flow designs, manage data dynamically, and improve the overall functionality of their automated processes. This capability leads to more organized and efficient workflows, enabling users to better control data throughout their operations.

    Similar to Workflow scratchpad variables, create variables that you can use and modify directly in your flow. Access flow variables as data pills directly in the Data panel.

    Use flow variables to set and retrieve values throughout a flow. Flow variables are similar to subflow inputs and outputs. Both define data available to a flow or subflow. The main difference between them is when they are accessible. Flow variables are accessible throughout a flow. Inputs are only accessible at the start of a subflow, and outputs are only accessible when a subflow completes.

    Creating flow variables

    Create variables with the Flow Variables option on the More Actions menu. You can create several variables at a time by choosing a name and data type for each one. Flow variables appear as data pills in the Flow Variables section of the Data panel.

    Assigning values to flow variables

    Assign values to variables with the Set Flow Variables flow logic. Set Flow Variables has the following inputs:
    • The name of the variable.
    • The data value for the variable.

    You can assign values to all of your variables with a single use of Set Flow Variables. Unlike other data pills, the values assigned to flow variables are mutable and can be changed at any time. Using Set Flow Variables overrides the current value of the variable. If no value is assigned to a variable, the default value is null.

    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. For example, these three variable definitions result in the variable having the runtime value of last value set.

    Table 1. Last value set defines flow variable value
    Order Variable Configuration
    1 variable first value set
    2 variable second value set
    3 variable last value set

    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. For example, these variable definitions only produce the expected runtime values when you maintain the order of the variable definitions.

    Table 2. Setting variable values by reference
    Order Variable Configuration Runtime Value
    1 variable1 One One
    2 variable2 {variable1}, Two One, Two
    3 variable3 {variable1}, {variable2}, Three One, Two, Three

    Flow execution details

    A summary of the Set Flow Variables flow logic appears in the execution details. The details show the name, type, configuration, and runtime values for all the variables set with the action. Execution details also provide information about the variables when they're used in actions or flow logic. In that case, it shows the type, configuration, and runtime values.

    Supported data types

    Workflow Studio supports the following data types for flow variables:
    • Array.Object
    • Date/Time
    • Decimal
    • Floating-point number
    • Integer
    • JSON
    • Object
    • Reference
    • String
    • True/False