Using variables in flows
You can use variables in multiple ways within a flow.
Variables connector
You can add the Variables connector to your flows. This connector has multiple capabilities that let you add variables to a flow and increment or otherwise change the variable’s value.
The variables connector can be used to update User variables and Flow Instance variables. It can also be used to create flow instance variables, but user variables must be created in the variables tab.
Including variables in code
You can include variable values in the code fields of nodes such as HTTP nodes, or as inputs in the fields of other nodes. Within the code field, click {}, then select a variable type.
You can also directly include a variable using the following syntax:
- Company Variable
-
{{global.company.variables.variableName}}
- User Variable
-
{{global.userInfo.variables.variableName}}
- Flow Variable
-
{{global.flow.variables.variableName}}
- Flow Instance Variable
-
{{global.variables.variableName}}
When you use a variable in this way, the variable’s exact value is included in the code, and you should take the variable type into account when writing the code. For example, a string variable should be surrounded by quotation marks, while a boolean variable or number variable should not.
Sharing variable values between flows
You can pass variable data between flows and subflows using input and output schemas, which pass information into and out of the subflow.
To use an input schema in a subflow, open the flow and click Input Schema. Use the variable name the Parameter Name, select the Data Type that corresponds to the variable data type, and enable Required if the variable is necessary for the flow to function. After you add a parameter to a subflow’s input schema, the Invoke Subflow or Invoke UI Subflow node that launches that subflow will include input fields that correspond to the input schema parameters. Add the variable values to these fields using the syntax described above.
To use an output schema in a subflow, click → Output Schema, then declare the variable’s name and type as part of the output schema JSON.
Next, open each of the nodes that sends a JSON success, error, or custom response at the end of the subflow. In the Additional Fields in the Response section, click Field. In the Value field, click {} and select Flow Instance Variables, then click the variable you want to share. You can also use the syntax described above to include variable values. Apply your changes to the node.