Variable management
This topic describes how to create and call variables, and how to configure expressions.
Function overview
You can use variables flexibly in your current conversation flow. Assign values to variables in service nodes, and reference them in other nodes using ${botVar.global_variable_name}.
Access the feature
Log on to the Cloud Contact Center console. In the left navigation pane, choose Instance Management - V2 and click the endpoint of a specific instance to go to its console.

Click the menu button in the upper-right corner of the page and select Digital Employee to go to the Digital Employee Business console. In the left navigation pane, choose AI Platform > Multi-turn Conversation (Dialog Studio) > Variable Management.

Create a global variable
On the Variable Management page, click Create Global Variable , enter the variable information, and click OK to create the global variable.

Variable usage example
Type "$" in an input box to see variable suggestions. The prefix "botVars." indicates a global variable.




Expression configuration
When configuring variable assignments, you might need system-defined parameters: environment parameters, service response parameters, and system parameters. The following table describes these parameters:

Environment parameters

${envVars['CURRENT_QUERY']}: User query.
${envVars['APP_ID']}: Bot ID.
${envVars['SENDER_ID']}: End-user ID.
${envVars['SENDER_NICK']}: End-user name.
${envVars['SESSION_ID']}: Session ID.
${envVars['CHAT_ID']}: Request ID.
${envVars['VENDOR_PARAM']}: in-band data.
${envVars['EMOTION_POLARITY']}: Emotion polarity.
${envVars['EMOTION_NAME']}: Emotion name.
${envVars['CURRENT_DATE']}: Current date.
${envVars['CURRENT_TIME']}: Current time.
${envVars['CURRENT_TURN']}: Current conversation turn number.
Service response parameters

${svcVars['functionOutput']}: Response from a global service.
System functions

${sysGetRandom(n)}: Returns a random number in the range [1, n].
${sysFormatDate('format')}: Outputs the current time in a custom format.
${sysAddDate(day)}: Adds a specified number of days to the current date and returns the result in yyyy-MM-dd format.
${sysAddTime(second)}: Adds a specified number of seconds to the current time and returns the result in HH:mm:ss format.
${sysUnescapeJson('str')}: Decodes a JavaScript-escaped string.
${sysIntervalDays('startDate','endDate')}: Calculates the number of days between two dates in yyyy-MM-dd format.
${sysIntervalSeconds('startTime','endTime')}: Calculates the number of seconds between two times in HH:mm:ss format.
${sysFormatStrDate('source','format')}: Converts a timestamp from yyyy-MM-dd HH:mm:ss format to a custom format.