The Runsub action icon, a curled piece of paper with two arrows pointing to the right next to it at the top and bottom.

Calls a subscript, which runs and then uses Return to return to and continue running the main script.

Runscript and Runsub are similar, but have slightly different functions. When Runscript triggers a subscript, there's no way to return to the first script from the subscript. When Runsub triggers a subscript, the script can return to the first script, as long as the subscript has a Return action. The Return action provides a value back to the Runsub action when the subscript is finished.

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


Property Details
ScriptName The script you want to spawn. You can click the Choose Script link at the top of the action's properties box to select a script stored for your business unit.
ReturnVariable The value that is returned to the main script is stored in this property. To pass multiple values, use an array as the variable.
Parameters Enter parameters (0-9) to send to the newly spawned script. When tracing a script, these parameters appear in the Begin action of the newly spawned script. In the trace output, the parameters are named in the Name column as p1 through pn (where n is the parameter count) and the actual variable name is in the Value column. Enter the parameters one per line in the editor. After adding parameters in the editor, you can expand the Parameters field to see each parameter that you previously entered.


Branch Details


Path taken unless the script meets a condition that requires it to take one of the other branches. It is also taken if the other branches are not defined.
OnError Path taken when the action fails to execute properly.

Tips & Tricks

  • This action can be especially useful if you have one or more larger scripts that you'd rather break into smaller scripts.
  • When the subscript runs, it stores a value in the ReturnValue property of the Return action and then passes that value back to the ReturnVariable property in the Runsub action on the main script.
  • The main script type and the subscript type must be the same. For example, if the main script is a phone script, the subscript must also be a phone script.
  • If you put a Runsub action in the main script, your subscript MUST have a Return action.
  • The main script and the subscript must be in the same folder.
  • Runsub can pass multiple variables from the main script to the subscript, but the subscript can return only one value (in the ReturnVariable property) to the main script.
  • Any variables defined in the subscript will no longer be available when the subscript terminates.

Phone Script Example Using Runsub

In the main script below (shown top), when the script is triggered, the Runsub action immediately triggers the subscript (shown bottom). In the subscript, Voiceparams sets the Text-to-Speech settings, and the Hours action sets branches for open, closed, and holiday to three different Return actions. When the subscript is finished, the values in the ReturnValues property (in the Return action) are stored in the ReturnVariable field (Runsub action in the main script). The Case action then sets the open, closed, and holiday branches as appropriate.

Main Script

An example script, showing Studio actions with arrows connecting them. Each action has a label beneath it to indicate what the action does in the script.

Would you like to download this script?


An example script, showing Studio actions with arrows connecting them. Each action has a label beneath it to indicate what the action does in the script.

The three Return actions provide values in the ReturnValue property so the Case action in the main script can determine which branch to follow.

Would you like to download this script?