Learn how to use variables in Designer.
You can use two types of variables in Designer:
Variable names must be alphanumeric, but not start with a numeric character. For example:
- Valid variable names = abcdef123 or c123badef
- Invalid variable names = 123abcdef or 3abcdef21
Variable values may be:
- ECMAScript objects, such as Date().
- Valid ECMAScript expressions. Do not add an ending semi-colon (;) as typically required by ECMAScript.
- Simple values, such as numeric or string.
- If the value is a string, it must be surrounded by single quotes (for example, 'value'). If the value also uses a single quote, you can use a backslash to escape the quote character (for example 'Joe\'s Pizza').
You can add user variables in the Initialize phase. You can assign initial values to these variables in the Initialize phase, or by setting values in an Assign block in the Initialize phase.
You can also assign a system variable as the default value of a user variable. For example, you might assign the system variable DNIS to a user variable you have created. (If the system variable does not have a value at the time of the call, the default values are used.) This is also supported for Self Service Shared Modules.
Variable values can be captured in a variety of data sources when Designer applications run on the Genesys platform. If a variable contains sensitive data or personally-identifiable information (PII), you can mark a variable as Secure to prevent the value from being logged or recorded as plain text in Designer and the Genesys platform.
How secure variables work:
- Secure variable values are not captured by application logs.
- If used to store the results of a user input, the user input is masked in platform logs.
- If used to play back a prompt, the prompt message is masked in platform logs.
- Secure variables are hidden from view to prevent them from being selected in blocks that record reporting information, such as Call Data, Activity, and Milestone blocks. (See the Warning below for more details.)
- Secure variables are not reported in Designer Analytics.
If you secure variables in an application that has already been published, you'll need to re-publish the application for the new settings to take effect.
- DO NOT attach sensitive data, such as personally identifiable information (PII) or secure variables, to userdata in the Call Data block. Otherwise, this information is captured by platform logs and reported in Designer Analytics.
- Designer normally hides secure variables to prevent them from being selected in blocks that capture reporting information. However, if you secure a variable that was previously selected in a block as a non-secure variable, Designer cannot remove the variable from the block or prevent its value from being exposed. To protect those values, you must create a new secure variable and re-publish your application.
The Initialize phase has a second tab that lists system variables — these variables are created with the application and cannot be deleted.
Most system variables are initialized when the application starts and can be used throughout the application, such as the Last Milestone variable. When your application starts, the initial value of Last Milestone is an empty string. While your application runs, the Last Milestone value is set to the last milestone that your application reaches.
The following system variables are available:
|DNIS||Specifies the dialed number.|
|ANI||The number associated with the calling party.|
|MaxTime||Maximum time (in minutes) to keep this session alive.|
|Timezone||The timezone used for this application, unless this value is overridden in other blocks.|
|Language||The default language for this application that is used for announcements.|
|AppLanguageName||The name of the default language for this application that is used for announcements.|
|RoutingSkills||A set of skills that might be specified in some blocks, such as Menu Option child blocks, that determine how the call is routed. For example, if you select a Skill in the Call Handling tab of a Menu Option block, this selection is stored in the RoutingSkills variable. Then, in a subsequent Route Call block, you can enable the Use system variables RoutingSkills and RoutingVirtualQueue set already in Menu Options check box to use the value of the RoutingSkills variable.|
|RoutingVirtualQueue||A virtual queue that might be specified in some blocks, such as Menu Option child blocks, that is used for routing unless a different queue is specified in Routing blocks. For example, if you select a Virtual Queue in the Call Handling tab of a Menu Option block, this selection is stored in the RoutingVirtualQueue variable. Then, in a subsequent Route Call block, you can enable the Use system variables RoutingSkills and RoutingVirtualQueue set already in Menu Options check box to use the value of the RoutingVirtualQueue variable.|
|EstimatedWaitTime||The estimated wait time for the call to be routed to an agent.|
|IVRProfileName||This application's calls will be associated with the given IVRProfile for VAR reporting.|
|GVPTenantID||This application's calls will be associated with the given tenant for VAR reporting.|
|SelectedTarget||This is the DN and the switch name of the target to which the interaction was routed or should be routed to definitively. The target format is Name@SwitchName.Type.|
|SelectedVirtualQueue||The virtual queue that was selected.|
|SelectedComponent||The agent-level target to which the interaction was routed or should be routed to definitively. If the target selected for routing is of type Agent, Place, Queue, or Routing Point, this variable contains the target. If the desired target type is Agent Group, Place Group, or Queue Group, the function returns the agent, place, or queue from the corresponding group to which the interaction was sent. The target format is Name@StatServerName.Type.|
|SelectedTargetObject||This is the high-level target to which the interaction was routed or should be routed to definitively. If a skill expression is used, the function returns: ?:SkillExpression@statserver.GA or ?GroupName:SkillExpression@statserver.GA. The target format is Name@StatServerName.Type.|
|SelectedAgent||This is the Employee ID of the agent to which the interaction was routed.|
|Access||(Optional) When present, this is an ECMAScript object that represents a switch access code. The table below show its properties and the corresponding switch access code fields:
|CustomerSegment||The segment to which the customer belongs, based on information that the customer has provided.|
|CustomerId||A unique identifier for the customer, based on information that the customer has provided.|
|EnableSSRecording||Enable call recording in the Self Service phase.|
|CallbackReporting||An object containing key-value pairs for callback reporting.|
|PositionInQueue||The call's position in queue while waiting to be routed to an agent.|
|AppCountry||The country code for this call (can be specified by the application).|
|AppRegion||The region for this call (can be specified by the application).|
|AppCallType||The type of call (can be specified by the application).|
|AppUserDisposition||A custom disposition that the application can use to specify a user-specific outcome.|
|AppUserDispositionCategory||A custom disposition category that the application can use to categorize user-specific outcomes.|
|AppDeflectionMessage||The application can use this variable to track deflections by specifying the message played when a caller disconnected their call.|
|AppLastMilestone||The last milestone that the application achieved.|
|AppStrikeoutMilestone||The last milestone that the application achieved before strikeout.|
|AppBailoutMilestone||The last milestone that the application achieved before the caller bailed out to an agent.|
|AppDeflectionMilestone||The last milestone that the application achieved before the caller was deflected.|
|ScriptID||The ScriptID as reported by the routing engine.|
|AppSelfHelpedMilestone||Used to contain a self help milestone.|
|SdrTraceLevel||Enables users to set the recording level. This variable accepts the following values:
|AppSessionType||The type of the session. The default value is inbound' for inbound calls. Survey applications must use the value survey.|
|EnableRouteCallRecording||Set to true or false to enable or disable call recording for routed calls in the Assisted Service phase. Leave blank to use platform defaults.|
|GmsCallbackServiceName||The GMS Callback Service name.|
|GmsCallbackServiceID||The unique identifier that GMS assigns to a scheduled callback.|
|survey_sOffer||Set by the Setup Survey block to specify if a survey was offered, setup, or rejected.|
|survey_iAgentScore||Holds the user satisfaction score for the agent, if this question is asked by the survey.|
|survey_iCompanyScore||Holds the user satisfaction score for the company, if this question is asked by the survey.|
|survey_iCallScore||Holds the user satisfaction score for the overall call, if this question is asked by the survey.|
|survey_iProductScore||Holds the user satisfaction score for the product, if this question is asked by the survey.|
|survey_iRecommendScore||Holds the user's rating score (on a scale of 0-10) of the company, product, or service. Used to calculate Net Promoter Score (NPS).|
|ApplicationRevisionSerialID||A read-only variable that increments by 1 each time an application is revised.|
|ApplicationPath||The absolute path to the application.|
|DefaultPartition||The default partition used to provide access control in GIR. This variable can be overridden by settings in the Record block.|
|AutoStopInteraction||(Digital only) Specifies whether or not the interaction is to be automatically terminated when the session ends. The default value is auto (to automatically terminate a chat interaction if it exceeds 20 application runs or exceeds the specified expiration time); other valid settings are true or false.|
|ChatEntryPoint||(Digital only) Holds the point of entry for a chat interaction. Can be used in application logic at runtime to provide alternative processing or to facilitate the use of parallel testing environments.|
|TreatmentIterationCount||Keeps track of how many times a treatment has been executed.|
|AgentsTotalSize||The total number of agents that are possibly available. For example, the total number of agents in a specified Agent Group.|
|AgentsLoginSize||The number of agents that are actually logged in.|
|enableSSML||Set as true to enable the interpretation of Speech Synthesis Markup Language (SSML) tags in TTS (Text-to-Speech) prompts.|
|removeSSMLInChat||Set as true to remove SSML tags from chat messages if an omnichannel application is using the same messages for both voice and chat channels.|
Use the IVRProfileName variable (User Data Key: gsw-ivr-profile-name) to associate the application VAR metrics with an IVR Profile. Use a value of auto to auto-detect the IVR Profile.
Use the GVPTenantID variable (User Data Key: gvp-tenant-id) to associate the application VAR metrics with a tenant. Designer attaches the value to user data. Use a value of auto to auto-detect the tenant.
These variables are listed in the properties of blocks once they are defined.
Assigning Values to Variables
Designer lets you assign values to variables in different ways. These examples show a few of the methods you can use to assign different types of values to a variable, including a JSON value.
Example 1: Simple Assignment
The easiest (and recommended) way is to assign a value to a variable using the Assignments tab on the Assign Variables block.
Click Add Assignment to add an assignment slot to the block, then choose a variable from the Variable column. For the Expression, you can use the name of another variable whose value should be copied in to the Variable column, a literal value (for example, "Sales Channel"), or an expression whose value should be calculated first and the results assigned to the Variable.
The varCustomerPrompt above shows a simple string expression, with the different string segments linked together by a +. If used in a Play Message block, it will play “Hello Joe! Welcome to Genesys." It accesses a property of the varCustomerData object using the “.” notation and combines it with the welcome message.
Here is another example of how you could build a JSON expression. It contains mostly hard-coded strings, but also uses a variable to form part of the JSON string:
Example 2: Advanced Scripting
To use this feature, you need a basic level of familiarity and understanding of ECMAScript syntax and rules. Any errors in the script can cause erratic behavior, so test your changes to make sure that your script works correctly.
In this example, the script sets the variable varOrdersPrompt to "3 Laptop bags, 2 Phone chargers, 1 Super rare fish". Here's how it works:
The sample script below first initializes JSON data in varOrderDetails so that it becomes an array of three JSON objects. Each JSON object has properties — item, quantity, backordered. The script then proceeds to loop through orders and forms a string to play back to the caller to notify them of their order status.
Note that this script uses variables in two scopes:
- A scope exclusive or local to this script itself (“i”). This variable remains available only while this script runs, and then it disappears.
- Top level variables that were defined in the Initialize phase — these remain available throughout this application flow, but not in any modules this application calls (such as varOrdersPrompt).