Variables
Variables allow you to access data contained in Forms and Flows to create custom business logic and automations.
Type of variables
Variables have different syntaxes in Forms and Flows.
Syntax | Where | Description |
---|---|---|
{{fields.field_id}} |
Forms | Reference data from form fields and hidden fields variables. |
{{state.state_variable_id}} |
Forms / Flows | Reference data from variables stored in state variables. |
{{input.body.field_id}} |
Flows | Reference input data from Forms in Flows. |
{{flow_action_id.output_property}} |
Flows | Reference output data from Flow actions. |
Variables in Forms
There are two types of variables in Forms:
Field variables
Hidden variables
Field variables
Field variables contain data collected from the user from input fields in the Form.
To reference form input data, use the {{fields.id}}
variable or select from the autocomplete menu. These variables can be referenced in a variety of form components including labels, hint text, rich text, and more.
Variable | Description |
---|---|
{{fields.field_id}} |
Reference to a specific field in Forms. |
Hidden field variables
Hidden variables contain data that is stored within the Flow. They are configured in the Start node and are not shown to the user.
To reference data from a hidden field variable, use the {{input.body.field.id}}
variable or select from the autocomplete menu.
Variable | Description |
---|---|
{{input.body.hidden_field.id}} |
Reference to a hidden field in Flow. |
Flow state variable
To reference data from a Flow state variable in your Form, use the {{state.state_variable_id}}
. To learn more, read State variables.
Variable | Description |
---|---|
{{state.state_variable_id}} |
Reference data from a Flow state variable in Forms. |
Variables in Flows
There are three types of variables in Flows:
Form input variables
Action output variables
State variables
Form input variables
Form input variables represent the input data from a Form field into a Flow action.
To reference data from the Form in a Flow, use the {{input.body.field.id}}
variable or select from the autocomplete menu.
Variable | Description |
---|---|
{{input.body.field.id}} |
Reference to a specific field from Forms. |
Action output variables
Action output variables represent the output data from Actions in Flows. To reference an Action output data variable, its Flow must first execute successfully.
To reference action output data, use the {{action_id.property_key}}
variable or select from the autocomplete menu.
Variable | Description |
---|---|
{{action_id.property_key}} |
Reference to a specific property from a Flow action return. |
To reference action output data from an HTTP request Action, use the {{action_id.body.property_key}}
variable or select from the autocomplete menu.
Variable | Description |
---|---|
{{action_id.body.property_key}} |
Reference to a specific property from a Flow HTTP request Action return. |
Example
You have an HTTP request Action that returns a user’s profile:
{
"user_id": "6496bd4...",
"email_verified": true,
"email": "username@domain.com"
}
Was this helpful?
You can access the Action’s user_id output property with the following syntax: {{action_id.body.user_id}}.
State variables
Flow state variables represent the data associated with the state
object of a given Flow.
To reference a Flow’s state variables, use the {{state.field_key}}
variable or select from the Autocomplete menu.
Variable | Description |
---|---|
{{state.field_key}} |
Reference to a specific state variable value in Flows and nodes. |
Flow state variables
Flow state variables let you reference data between subsequent Flows and form nodes. To create state variables, use the Store state variable action.
You can reference a state variable after its Flow has executed successfully. State variables are associated with a specific Form journey and their values cannot be accessed outside of that journey.
Variables best practices
Use meaningful IDs
When you add a Form field or a Flow action, its ID is automatically generated.
Update the ID to a more descriptive value so you can more easily identify the information it contains.For example, if you create a Form field that stores the user’s first name, update the ID to first_name.
Be mindful when updating existing IDs
If a variable is already in use and you need to modify its ID, identify where you have referenced it and update its ID accordingly to avoid undefined or empty values.
Check Flow executions
If you see an unexpected variable value, use the Executions view to troubleshoot the variable.
Use the autocomplete menu
The autocomplete menu helps you locate and properly reference existing variables.