Use braces to display variable values in scripts
To display the current value of a variable in a script page, or to use it within an action, enclose the variable name in two sets of curly braces: Hello, {{Outbound.First Name}}
This technique is useful to:
-
Display the current value of any variable, including variables derived from contact columns.
-
Display totals and other values accumulated in variables.
-
Embed the values of variables for agents to read in the narrative of a script.
To display the current value of a variable on a page:
Add a text input component to a page, and then type {{variable name}}
, replacing variable name with the name of any variable defined in the script. If the Outbound property is enabled for your script, you can display the value of contact columns too.
Example:
Suppose that a variable named Product Purchased
contains the name of a product purchased by the customer, and that you want your outbound script to display the customer’s name and product purchased. The customer’s first and last names are stored in your contact list in columns First Name and Last Name.
When the system displays contact column names as variables, it prepends “Outbound.” So, the variables that correspond to contact columns are named Outbound.First Name
and Outbound.Last Name
respectively.
Here’s what to do:
-
Add a text input component to your script page.
-
Type
Hello, {{Outbound.First Name}}, {{Outbound.Last Name}}. Thank you for purchasing {{Product Purchased}}.
-
Click Preview. The current value of
Product Purchased
appears.In preview mode, variables from the contact list appear within square brackets to signify valid data elements. At run time, the contact’s first and last name are retrieved from the contact list and displayed.
-
Click Preview again to return to edit mode.
Use caution when assigning a different contact list to a script
Once a contact list is assigned to a script, you can display run-time values of contact columns in the script by enclosing variable names in braces. For example, a script might display the first name of each outbound contact, if a text component contains the name of a contact column variable:
Hello {{Outbound.First Name}},
In preview mode, the variable name appears in square braces, since no data is read from a contact list in preview mode:
Hello [Outbound.First Name]
If you use contact column variables, be careful when you change the contact list that is assigned to the script. If the new contact list does not contain columns with the same names, the script cannot display values. If preview mode shows a variable name in curly braces instead of square braces, then the variable is not accessible and you may need to change the variable name to match a column in the assigned contact list. Curly braces are always displayed in edit mode, however.