Return

This help page is for CXone Studio. This information is also available for Desktop Studio.

Completes the subscript triggered by Runsub in another script.

Return stores a single value in the ReturnValue property and passes it back to the script that called the subscript. ReturnValue is stored in the ReturnVariable property in the Runsub action.

Return should always return control back to the main script. Best practice is not to end a script while in a subscript.

Supported Script Types

A square with a line branching from it that goes to three other squares.

Generic

Email Chat Phone Voicemail Work Item SMS Digital

Input Properties

These properties define data that the action uses when executing.

Property

Description

Add Caption

Enter a short phrase that uniquely identifies this action in the script. The caption appears on the script canvas under the action icon.

ReturnValue

The variable that holds the value you want to pass to the main script. This value is stored in the ReturnVariable property of the Runsub action in the main script.

Result Branch Conditions

None

Tips & Tricks

The ReturnValue can be an array or dynamic data object. If you use a dynamic data object, convert it to JSON or XML using the asjson() or asxml() function. Then you can pass the JSON or XML to the main script as a single string value. In the main script, you can convert the value back to a dynamic data object.

Script Example

This is an example to show how this action can be used in scripts. It is not intended to be a complete script. Additional scripting may be required.

The example below is a subscript that uses three Return actions to values back to a main script.

Would you like to download this script?