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 4). There are two types of variables: Custom (1) and System (2), presented in two different tabs (Figure 4).
- 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.
In the Render View node, only custom variables are used. This tab (Figure 5) allows you to manage them.
To create a variable, click the Add variable button (Figure 5 - 1). To edit or delete a variable, click the Actions menu (2) and then click the Edit (3) or Delete (4) option.
When adding or deleting a custom variable, a modal is displayed (Figure 6) with two required fields: the variable name (Figure 6 - 1) and the source (2).
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 7 - 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 the table below to find which variables are currently being exposed.
- 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 7 - 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.
If the variable has multiple levels, the path must be written using a dot notation (.) between levels.
Each variable name must be unique.
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.
If you have any questions, or if you’re having any technical issues, please open a ticket using this form.
Updated 26 days ago