Return

This help page is for Desktop Studio. This information is also available for CXone 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

The icon for a Generic script type - a rectangle with < and > symbols inside it.

The icon for the Email script type - a large @ symbol in a diamond.

The icon for the Chat script type - a chat bubble with an ellipsis inside (...), in a diamond shape.

The icon for the Phone script type - an old-style phone handset with curved lines indicating sound coming out of it.

The icon for the Voicemail script type - a symbol that looks like a cassette tape - two circles sitting on a horizontal line.

The icon for the Work Item script type-a piece of paper with one corner folded down and a bullet list on it.

The icon for the SMS script type - a smart phone with a chat bubble coming out of it.

The icon for the Digital script type - a computer monitor with a smartphone next to it.

Generic

Email Chat Phone Voicemail Work Item SMS Digital

Input Properties

These properties define data that the action uses when executing.

Property

Description

Caption

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

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?