Assign Variables Block

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Designer User's Guide for version Current of Designer.

Use the Assign Variables block to assign a new value or expression to user variables.

Related documentation:

You can use the Assign Variables block in any phase of the application to assign a new value or expression to any of the user variables. Those variables can be used in other blocks whose properties support variables (for example, TTS prompts). The last-known state of variables is captured in metrics just before the SCXML session ends.

User variables are specified in the User Variables tab of the Initialize phase. When the application starts, those user variables are declared and assigned the user-specified default value.

You can use the Sort Function tab to sort the elements of a JSON array in a specified order. A maximum of three keys can be specified with each array. The same array can be sorted multiple times; therefore, the number of sort keys is unlimited.

The Assignments tab is processed before the Sort Function tab when your application executes the Assign Variables block. Do not assume that assignments are processed after sorting within the block. To extract specific parts of data after sorting, add another Assign Variables block after the one that performs sorting.

Assignments tab

Assignments tab of the Assign Variables block

Click Add Assignment to assign a value or expression to a variable.

  • Select a variable from the Variable drop-down menu.
  • Enter a value or expression for the variable in the Expression field. The value can be a simple literal value (such as a string, integer, or Boolean) or any valid JavaScript expression. The value expression can refer to other variables.
  • If you are using a function in an Expression and are on Designer Private Edition or Multicloud CX hosted on Azure, you must include a directive. See Using functions in expressions for more information.
  • Tip
    When assigning a string value to a variable, you must ensure that you enclose the string value with quotation marks. Otherwise, the string is interpreted as a reference to a variable.

Using functions in expressions

For Designer deployments on Private Edition or Genesys Multicloud CX hosted on Azure, the following directive must be added when using a function in expressions:



/*pragma:ors_await*/ _genesys.queue.priorityTuning(InteractionID, true, false, false);

/*pragma:ors_await*/ _genesys.queue.setInteractionAge(InteractionID, true);

Example expressions are provided for illustrative purposes only. Due to certain platform dependencies and limitations, not all functions are supported when used in Designer.

Sort Function tab

Click Add Sort Function and select an Input Array that contains a valid JSON array with values that you want to sort.

Enter up to three values in the Key to Sort By fields. These values must exist in the array. If an element does not have the specified value, it is skipped by the sort function and the value appears towards the end of the list.

Optionally, specify a Sort Order and Key Data Type. For the date type, you can use the following formats:

  • yyyy-MM-ddTHH:mm:ssZ
    • Example in Greenwich Mean Time (Zulu): 2015-06-01T12:13:14Z
  • yyyy-MM-ddTHH:mm:ss[+-]HHmm
    • Example in Pacific Time: 2015-06-01T12:13:14-0800
You can specify a Key Data Type to use data-aware sorting to treat different keys differently. If you do not specify a data type, the sort function treats all sort keys as strings and sorts those strings.
Des assign sortfunction.png

Advanced Scripting tab

Advanced Scripting is an optional feature and might not be enabled on your system. To enable this functionality, contact Genesys.

Click Advanced Scripting to enter your own ECMAScript expression. For more information, see ECMAScript Expressions.

Des assignvar advanced.png

Retrieved from " (2024-05-18 22:33:43)"
Comments or questions about this documentation? Contact us for support!