Variables are entities that can be used throughout an automation to collect information to:

  • Personalize the experience by storing a value and using it in the interaction.
  • Store information to be used in the flow by different components, like the Render View or Split Flow, or to be passed to external systems.

You can manage variables using the variables tool located at the right edge panel (Figure 1). There are two types of variables: Custom (1) and System (2), presented in two different tabs (Figure 1).

2880

Figure 1 - Variables editor tabs

  • Custom variables - can be managed at the automation level and are stored as metadata for each automation.
  • System variables - defined by the system and available for every automation of that type. System variables cannot be managed on each automation and are not stored as metadata for the automation.

Managing Variables

In the Render View node, only custom variables are used. This tab (Figure 2) allows you to manage them.
To create a variable, click the Add variable button (Figure 2 - 1). To edit or delete a variable, click the Actions menu (2) and then click the Edit (3) or Delete (4) option.

2880

Figure 2 - Custom variables management

When adding or deleting a custom variable, a modal is displayed (Figure 3) with two required fields: the variable name (Figure 3 - 1) and the source (2).

2880

Figure 3 - Adding variables section

It is possible to add variables from different sources. The available sources are:

  • Current Automation - create variables in the current automation. The variables are loaded locally and only work for the specified automation. The variables cannot be shared between cards.
  • Studio - add variables from Studio flows. Studio-collected information is stored in flow variables that can be reused in other flow components, like the Render View node.
  • Workspace - add variables from Workspace apps.
  • Active Panel - add variables from the panel in which this card is being rendered. When this source is selected, you can exchange variables between cards in the same panel.

🚧

The Studio and the Workspace sources are read-only. You are able to access the variable value, but you can't modify it.

The Current Automation and Active Panel sources are read-write, allowing to write and read from the same variable.

Depending on the selected source, a Path (Figure 4 - 2) field is also required. This field is shown for:

  • Studio - use the variable name as defined in the Studio flow context.
  • Workspace - while an agent interacts with Talkdesk Workspace, apps publish some variables on this source. Please check each product documentation to know which variables they're exposing.
  • Active Panel - use the variable as defined in the active panel flow.

Besides the required fields, it is possible to add a default value for a variable so that it starts with that value (Figure 4 - 1). This value is only of type string, so if you insert another type such as an array, object or others, the value will be considered to be a string.

1429

Figure 4 - Variable path

🚧

If the variable has multiple levels, the path must be written using a dot notation (.) between levels.
Each variable name must be unique.

Using Variables

To use the variables in the flow, use the following syntax:

  • Context.setVariable(variableName, value) - to set the value of the variable.
  • Context.getVariable(variableName) - to get the value of the variable.

👍

Since the name of each variable must be unique, it is not necessary to specify the source of the variable.

🚧

Troubleshooting

If you have questions or technical issues, please open a ticket using this form.