Pre-Defined Variables

The information on this help page applies to both CXone Studio and Desktop Studio.

Pre-defined variables are system variables that are already defined. You can use them in your scripts without creating them. It's possible to override the expected value for pre-defined variables, but it's not recommended. Only override these if the online help or a CXone Account Representative instructs you to.

Pre-defined variables are automatically added to scripts. Some come from system scripts that run behind the scenes before an interaction is routed to your scripts. These are also called system variables. Other pre-defined variables come from the actions you add to your scripts. You can use the trace tool to view the variables in a script. As you click through each action in the trace output, the Variables tab shows you the actions in the script at that point.

View Pre-Defined Variables in a Script

You can view the variables in a script using the trace tool. If you trace a script during an interaction, you can see the variables that are passed into it. These variables come from system scripts and other sources, such as the phone service provider. You can trace a script with a simulated interaction, but you can only see the variables passed into it from system scripts. This section describes tracing a simulated inbound phone script. You can also view the pre-defined variables in a script by running a trace on other interactions.

  1. In Studio, open a script.
  2. Click in the white space on the script canvas and then click the Properties tab.
  3. Click Inbound to expand it, then complete the following properties:

    • PhoneNumber: Enter the number of a phone you have access to.
    • SimulateInbound: Select True.
    • SimulationANI: Enter the same number you used for the PhoneNumber property.
    • SimulationDNIS: Enter another phone number. It doesn't have to be a real phone number.
  4. In the Studio toolbar, click Start with Trace.
  5. When your phone rings, answer it. You can follow the prompts if you want to see the variables added by actions further along in the script. If you want to see the system variables passed into the script, you can hang up.
  6. In the Trace Output window, click the Begin action. The Variables tab displays all the variables passed into the script from system scripts.

  7. Double-click a variable to see the name of the variable and its value. This is helpful for variables with long values that don't fit in the Value column.

    If you want to see additional variables added to the script as an interaction progresses, click other actions in the main section of the Trace Output window.

Common Pre-Defined Variables

The following table contains some of the more common pre-defined variables. Not every script will contain all of the variables in the list. The pre-defined variables that are available in a script depend on the script's media type and the actions used in the script. Additionally, some variables come from the service provider. Those variables may vary depending on the provider.

Before using any of the variables in this section, verify that they are present in the script you're working on using the trace tool. Using pre-defined variables in a script when that variable isn't passed into the script or added by an action can result in scripts that don't function as you intend them to.

When possible, verify the variables in your script using a live interaction and not a simulated interaction. Simulated interactions may contain variables that a live interaction doesn't. Similarly, a live interaction may contain variables that a simulation doesn't.

Variable Name Description
__agentContactID The session ID for the agent application session.
__agentId The ID of the agent that answers an interaction. This variable contains no value until an agent answers the interaction.
ANI

The caller's telephone number in North American Numbering Plan format. This is standard format for phone numbers in North America. The e164ANI variable holds the same number but in international format.

This value comes from the phone carrier. Possible values include Restricted and Anonymous.

busno

The number of your business unitClosed High-level organizational grouping used to manage technical support, billing, and global settings for your CXone environment. This is the unique identifier for your company in CXone.

If your organization has more than one business unit, you can use this value to use logical determinations in your script. For example, you can check the busno before assigning an ACD skillClosed Used to automate delivery of interactions based on agent skills, abilities, and knowledge to ensure you're assigning a skill that exists in the business unit.

contactId The unique identifier for each contact. The contactId makes it possible to find and report on a specific contact. A new contactId is created if a secondary script is spawned.
city The name of the city where the call originates.

For inbound interactions, this value comes from the contact's service provider. For outbound interactions, this value comes from your service provider.

country

Name of the country designated by the country code (see next item) in the phone number string of an inbound or outbound call. The CXone telephony platform generates this automatically based on  International Telecommunication Union (ITU) values and passes it in the call metadataClosed Data that provides information about other data..

For inbound interactions, this value comes from the contact's service provider. For outbound interactions, this value comes from your service provider.

countryCode

International Telecommunications Union (ITU) code designating the country of origin for an inbound call, or the country of destination for an outbound call. This code appears at the beginning of any phone number string and is passed in the call metadata. For example, the ITU code for the United States is +1. To see the country code for any given country, do an Internet search for country code <country>. The format of this may vary depending on the origin of the call.

For inbound interactions, this value comes from the contact's service provider. For outbound interactions, this value comes from your service provider.

DNIS The number that the caller dialed in North American Numbering Plan format. This is standard format for phone numbers in North America. The e164DNIS variable holds the same number but in international format.

e164ANI

e164DNIS

The ANIClosed Also known as caller ID. Listed phone number of an incoming voice call. and DNISClosed Identifies the number the contact dialed to reach you for inbound voice calls and the number the agent or system dialed on outbound voice calls. formatted according to E.164 telephony formatting standards. E.164 is an international standard for formatting phone numbers outside the United States.
from The sender's email address.
__httpstatuscode The HTTP status code returned from the server that the REST API action calls.
__httpstatusdescription The HTTP status description returned from the server that the REST API action calls.
isReskill Indicates in the current contact ID has been reskilled. Values are 1 (true) or 0 (false).
__lastStateChange The timestamp of the last time a contact changed states. For example, when a contact changes from the Prequeue state to Queued, this variable populates with the timestamp of when that change took place.
masterId

The unique identifier that enables all scripts originating from the same parent to be identifiable. It's used when one script spawns or is run from another. For the parent script the contactId and masterId are the same. For any child script, the contactId is a new unique value and the masterId is the same value as the parent script's contactId.

For example, when you reskill interaction, the reskilled interaction's masterIdis the same as the original interaction's contactId. If the interaction is reskilled a second time, the newly-reskilled interaction's masterId is the same as the child script's contactId.

__mediaServerName The name of the media server. This variable is useful for troubleshooting server-related issues when working with NICE CXone technical support. Issues include things such as such as remote latency or telephony problems.
__POC The unique ID of the point of contactClosed The entry point that an inbound contact uses to initiate an interaction, such as a phone number or email address.. It matches the ID in the CXone ACD application.
__SIPInvite Contains header information for the contact. If you transfer a call from one business unitClosed High-level organizational grouping used to manage technical support, billing, and global settings for your CXone environment to another, this variable contains information about the original call. For example, you can access the contactID of the call from the original .
__Skill

The unique identifier for the particular ACD skillClosed Used to automate delivery of interactions based on agent skills, abilities, and knowledge. The __Skill variable makes it possible to find and report on a specific skill. This value can change with the Reqagent action.

_SkillName The name of the ACD skill. It accompanies __Skill and can change with the Reqagent action.

state The state in the United States where the caller lives. This value comes from the contact's service provider.
test Do not attempt to set this variable outside of a Snippet action (help page in CXone Studioaction). Doing so may result in severe consequences. It is reserved for debugging code in a Snippet action.
to The destination email address.

Pre-Defined Variables from Uptivity

s
Variable Name Description
_customFilter

The value for this variable is used as the ACD Gate filter in NICE Uptivity.

_user1 - _user 8

The value for these variables is used to populate the User 1 through User 8 fields in NICE Uptivity.

User9

While User9 is not technically a variable, it does get its value from the agent's user account, specifically from the value in Custom 1 properties and populates the User 9 field in NICE Uptivity.

User10 While User10 is not technically a variable, it does get its value from the agent's user account, specifically the value in Custom 2 properties and populates the User 10 field in NICE Uptivity.
_surveyDNIS

This value is a user-created, unique ID that is assigned when you create a NICE Uptivity survey and used to determine which survey to run during callbackClosed Holds a customer's place in queue and automatically calls the customer when they move to the front of the queue..

_surveyCallbackDNIS

This value is the number that will be used in the callback for the survey. This variable is for use with a NICE Uptivity survey only.

_surveyCallbackANI

This value is the caller ID that will display during callback used for the survey. This variable is for use with a NICE Uptivity survey only.