To work with User Data in Composer, you can use:
- The Interaction Data block for voice applications.
- The User Data property of the External Service block if you wish to pass User Data to an external service (routing and voice).
- The Entry block to access User Data (routing and voice).
For routing applications, you can use:
- The User Data block.
- The CreateEmail block, which lets you pick up standard response text from User Data.
- The CreateSMS block, which lets you pick up message text from User Data.
- The Identify Customer block, which provides an option to update the interaction’s User Data with the parameters returned by Universal Contact Server (Contact attribute data).
- The Create Interaction block, which lets you create a new interaction record in UCS database based on User Data.
- The ECMAScript block. The Script property lets you use Universal Routing Server User Data functions. Open Expression Builder. Select URS Functions and then _genesys.ixn.deleteuData (to add a User Data property or delete all properties) or _genesys.ixn.setuData (to add new or update existing User Data).
- A specific variable ‘xyz’ can be accessed directly; for example: _genesys.ixn.interactions.udata.xyz
- To write to User Data, use the setuData() function in an ECMAScript snippet. Usage is similar to the example below.
var input = new Object();
input.xyz = InputValue1; // Specify a value for the key ‘xyz’.
input[‘my-key-nname’] = ‘value’; // Use this notation if the key or property name has a hyphen in it. Note that‘my-key-nname’has hyphens.
- Reading User Data is easier using the Assign block than with the ECMAScript block.
Mandatory Data for UCS Blocks
When working with the Update Contact and Render Message blocks (which map to Universal Contact Server services), certain properties must exist in the interaction User Data.
For the Update Contact block, ContactId must exist.
For the Render Message block, ContactId (if some contact-related Field Codes (as described in the eServices 8.1 User's Guide) are used in the text to render). Also InteractionId (if some interaction-related Field Codes are used in the text to render)and OwnerEmployeeId (if some agent-related Field Codes are used in the text to render).
As is the case with IRD, these properties are not set in the blocks themselves. Instead, the properties are assumed to be put in the interaction's User Data by some other block earlier in the workflow, such as the Identify Customer block or Create Interaction block with the Update User Data property set to true. In case no other block does this, the User Data block may be used for this purpose.
If these properties are not available, an explicit UCS error message (missing parameter) shows in the Orchestration Server log.
Retrieving multiple KV Pairs in a user data object
To retrieve multiple KV pairs in a user data object:
- Set the multivalued-prop-in-udata configuration option to true in Orchestration server.
The values can be accessed from Composer using:
- _genesys.ixn.interactions[_data.system.context.InteractionID].udata.<KeyName>._genesys_Multivalue (for retrieving all values).
- _genesys.ixn.interactions[_data.system.context.InteractionID].udata.<KeyName>._genesys_Multivalue[i] (for retrieving a specific value at an index i).