This component allows you to create a global variable, which means that it can be used or accessed across different routing points or even in other operations. This is made possible through the use of a token.
It is located in the component group called “Basics” and is available in all types of routing (“Voice”, “Interaction”, “Chat”, and “CRM + webhook”) and Agent Scripting.
Configuration #
To use this component correctly, you need to follow these steps after inserting it into the routing where you want to create the global variable, generate a token, and configure the variable name and its value.
Follow these steps to create the global variable:
- It is necessary to generate a token for the use of this component.
- Generate a token by clicking on the highlighted button in the image. It is recommended to use a different token for each process. The generated token will be displayed in the “Token” field.
- In the “Action” field, select the “Update” option, which sets the variable as global.
- Define the name of the global variable in the “Global Var” field. The variable name should be preceded by a dollar sign ($), for example, $globalvar.
- Assign the value to the variable in the “Assign to” field, whether it is numeric or text. Leave the field empty by typing “null” if you want to leave it blank. If you prefix the dollar sign ($) to the variable, it indicates that the variable already exists. If you omit the dollar sign, it indicates that you want to create a new variable.
- You can copy the token using the highlighted button in the image, as you will need to paste it in other routing points or operations where you want to use the created global variable.
- Click “Save” to apply the changes made in the component.
Note: Variables that have not been used for one month will be deactivated.
Follow these steps if you have already created the global variable and want to use it in another routing point or operation:
- In the “Token” field, paste or type the generated token.
- In the “Action” field, select “read” which reads the global variable and assigns its value to a variable in the editing routing point.
- In the “Global Var” field, type the name of the global variable.
- In the “Assign to” field, type the name of the variable to which you want to apply the value of the global variable.