Contents
Call Data Block
You can use the Call Data block to read and write data that can be accessed from both inside and outside the application.
You can add the block to the Self Service or Assisted Service phase, but the block can behave differently depending on the phase in which it is used. These differences are noted where applicable, so be sure to review the information carefully when setting up the block.
The data format consists of key-value pairs (KVP). That is, for every key in the call data, you can associate a value with it. This value can be represented as an integer, character string, binary (boolean) type, or as a list of KVPs (see an example of how to do this).
While data in application variables only exist within the application, information stored in call data can persist and be retrieved even after the application finishes running. This is useful for retrieving information about the call that was created before the application started running, or for saving some information about either a caller or a call to a database so that it can be processed later by another application.
There are certain variable names used by the Designer application that must not be updated by the Call Data block. See Restricted Variable Names for a list of these variables.
Syntax requirements
When entering values, you must escape quote characters in values by using a preceding backslash. For example:
- Correct: Joe\'s Pizza
- Incorrect: Joe's Pizza
The Call Data block only accepts string type keys and values, so you do not need to enclose these values in single quotes.
Read Data tab
Use the Read Data tab to specify keys to be read from Call Data and stored into application variables. You can toggle the key being read between a variable and a string.
Edit Data tab
Self Service phase
If this block is in the Self Service phase, use the Edit Data tab to specify key-value pairs to be written to the call data (see an example).
When used in Self Service, the Call Data block has the following restrictions:
- Non-variable key names must follow standard JavaScript rules for variable names, even if the keys are not variables. For example, key names must only contain alphanumeric characters (no spaces) and not match any of the restricted variable names.
- Call data cannot be deleted. The Edit Data tab does not have the Remove option, as is available in the Assisted Service phase.
When a key-value pair list is used as a value in the user data for a Call Data block in the Self Service phase, the user data is attached to the call, but the platform encodes any special characters that appear in the user data, such as single quotation marks ('), double-quotation marks ("), backslashes (\), commas (,), colons (:), semicolons (;), and so on.
You can specify literal or variable values (or a combination) for each KVP, using one of the following options:
Variable Key + Variable Value
If you enable the variable checkbox for Key, the variable checkbox for Value is automatically selected and its dropdown menu is disabled (i.e. grayed out). Whichever variable you select for Key is also applied to Value. In this case, Designer will update the Key in the call data with the name of the variable and the Value with the value that is stored in it:
Literal Key + Literal Value
You can also enter literal values for both Key and Value. In this case, the entries are not required to match; each value is written to the call data as specified:
Literal Key + Variable Value
If using a literal value for Key and specifying a variable for Value, make sure that the name of the variable you select does NOT match the entry provided for Key:
Otherwise, the call data won’t be updated correctly.
Assisted Service phase
If this block is in the Assisted Service phase, use the Edit Data tab to specify key-value pairs to be written to the call data, either by adding data with new keys (Add/Update operation), updating data for existing keys (Add/Update operation), or deleting data for existing keys (Remove operation):
- Add/Update - Add or update data with the specified key. This operation automatically adds the key-value if the specified key does not yet exist in the Call Data, or, if the provided key does exist in the Call Data, it automatically updates data for the key. You can toggle both the key and the value independently between a variable and a string.
- Remove - Provide the key for data you want to delete, which you can toggle between a variable and a string. At runtime, if the key you try to delete does not exist, nothing happens.
For operations that involve large amounts of key-value pairs (i.e. 30 or more), see Adding or Removing Large Amounts of Key-Value Pairs.
You can also add a list of key-value pairs by selecting a variable that holds key-value pairs in a JavaScript object.
Advanced tab
If this block is in the Assisted Service phase, use the Advanced tab to add an extension as a key-value pair to the key. Click Add Extension Data to add an extension as a key-value pair to this block. The value type can be a string or integer.
If you want to use a variable for the Key or Value, select the Variable checkbox and then select a variable from the drop-down menu. If the Value is an integer, select the Integer checkbox.
You do not need to enclose extension values in quotes. However, if the quote is part of the value, you must escape the quote character by using a preceding backslash (see Syntax requirements.)
This image shows a few different ways that key-value pairs can be added as extensions:
Examples
Self Service
For this example, we want to use the Call Data block to specify a key-value pair to be written to the call data. We've created a variable called CustomerSegment that Designer will use to store the segment detail about the customer (for example, Bronze) and we want to associate its value with the segment key in the call data.
On the Edit Data tab, we'll click Add Data to specify a new key-value pair. For the Key field, we'll enter segment. For the Value, we'll enable the Variable checkbox and select the CustomerSegment variable we created earlier.
Watch:
For more information about using the Edit Data tab in the Self Service phase, see Self Service phase.
Assisted Service
This example shows how you can assign the value of a key-value pair in the Call Data block to a variable in the Assisted Service phase.
First, initialize your variables as various data types (integer, character string, binary [boolean], and so on), and create a variable for your KVP (in this example, we are using var_kvp):
Next, initialize a variable as a list of kv-pairs using the Assign Variables block. This example shows this using an ECMAScript on the Advanced Scripting tab:
Finally, add the user data as a kv-pair in the Call Data block:
Adding or Removing Large Amounts of Key-Value Pairs
If you want to add or delete several (i.e. 30 or more) key-value pairs, you can use the Advanced Scripting tab of an Assign Variables block to create a JSON object that lists each of the keys you want to modify.
For example, to remove a large amount of key-value pairs, create a script that assigns each key a 'null' value. In this example, we've defined an object called jsonData and assigned each of its keys a value of null:
If you wanted to add/update the keys, simply use the script to assign the desired values to each key. You can then reference this JSON object as a variable in the Call Data block to perform the desired operation:
Note that the operations are processed in smaller batches, to prevent too many requests from being processed at one time.
Restricted Variable Names
The following variable names are used by the Designer application and must not be updated by the Call Data block.
- _CB_N_CUSTOMER_ABANDONED_WHILE_WAITING_FOR_AGENT
- _CB_SERVICE_ID
- _CB_T_CALLBACK_ACCEPTED
- _CB_T_CUSTOMER_CONNECTED
- _CB_T_SERVICE_START
- _COMPLETE_CS
- _SEND_FINAL_UE
- CustomerSegment
- EXECUTION_MODE
- GMS_UserData
- gvp-tenant-id
- gsw-ivr-profile-name
- GSYS_IVR
- GSYS_SystemApplicationDisposition
- IApplication
- IApplicationVersion
- IPurpose
- orsurl
- orssessionid
The addition, updating, and removal of Call Data do not happen instantaneously while the application is running. The application starts the operation to edit the Call Data, and then continues to the next block, without waiting for confirmation that the Call Data is successfully modified.
Thus, there is no guarantee that the "write" operation has finished—a subsequent "read" operation could potentially give you either an old value or an updated value on different runs through the application.
For this reason, Genesys recommends that you do not write a key-value pair and then attempt to read back the same key from the Call Data within an application. If you need to access a Call Data value that was already edited within the application, Genesys recommends that you use the corresponding application variable.