Variables
- Predefined (or System) Variables
- User-defined Variables
Pre-defined variables hold values that are automatically created and assigned within Studio. For example, ANI (automatic number identification)Automatic Number Identification; also known as caller ID. Listed phone number of an incoming voice call. is a variable that holds the caller's phone number (caller ID). In certain scripts, where needed, ANI can pull the caller ID. As a variable, ANI changes each time the script runs and the caller ID is pulled. Pre-defined variables cannot be assigned a custom value and cannot be replaced by a newly created variable.
User-defined variables are created (using the ASSIGN action) by the user for the purpose of holding a value the user needs later in the script. You can create any type of user-defined variable as long as you use alphanumeric characters and you don't duplicate the names of the pre-defined variables.
When do I use curly braces { }in a variable?
For string variables, if you need to reference the value stored in the variable, enclose the variable name in curly braces. For example, The customer name is {customer} becomes The customer name is Tom Smith. Numeric values do not use curly braces because they do not accept variable substitutions.
When do I use numeric variables vs. string variables?
Refer to String and Numeric Methods.
What is a global variable and when do I use it?
A global variable is used when it is necessary to use a variable in other scripts during the same contact.
Global variables are commonly used in subscripts or spawned scripts. Additionally, the ASSIGN action is used to create a global variable.
Global variables are prefaced with Global: as shown below:
Global:Name="John Doe"
or
Global:Name="{firstname} {lastname}"