Working with Variables

Variables can be used in multiple locations in a Studio flow to collect data points that will be used to make routing decisions.

Each component may expose “step variables” or data points from which the variables can be created when clicking on the dropdown and then on Create variable:

These variables can later be used to initialize or update some flow variables.

For example, the Incoming Call component exposes several data points (contact details, source, and dialed phone numbers).

Another example is the ​Standard IVR​ component, which collects the keys pressed by the caller and populates the "selection" variable; it also populates the “exit_name” variable, whose value retrieves the name of the exit assigned to the selected key press.

These variables can then be used in other components.

How to write the name of a new variable:
• Do not use spaces. You can use an underscore and numbers instead.
• Write all letters in lowercase.
• Do not use accents, apostrophes, or other special characters.
• Add an underscore before the number, if you are using letters and numbers to name a context variable.

Example: case_1

When used in a text field, the syntax to reference a variable is:

%{current_flow.variable_name}

Using the example above, the syntax would be:

%{current_flow.case_1}

For example, you can use a variable in the Play Audio component to play a customized greeting message. To reference a variable, the above-mentioned syntax can be applied, with the variable being automatically converted into a chip, or it can be selected directly from the helper’s list. The Studio component’s field will display the variable’s display name.

The variable can be initialized from the initial component (Incoming Call) or via a data dip in your CRM system.

Another example is the usage of a variable to define the “Weight ratio” value(s) in the “Traffic Splitter” component.

📘

Notes

  • The way of referencing a variable in Studio components with the automatic conversion of the %{current_flow.variable_name} syntax into a chip and with the helper, as shown in the image above, is available across text and number input fields. For number input fields, basic formulas, like concatenations, are not yet supported, meaning a single variable should be used in these types of fields for the moment.
  • Please keep in mind that an underscore should be placed before the number in case you are using letters and numbers to name a variable that will later need to be referenced (in a query, for example).
  • When working with variables, you can find error scenarios such as for a wrong variable type, a variable that does not exist, or a reference that is invalid. In such cases, the chip will show in red and an error message will be displayed next to the component’s field.

Additional Resources:

Talkdesk Academy - Studio: Introducing Variables