Define a custom script action
To add a custom script action, follow these steps:
Click Actions .
To add an action, click Add Action .
Type a name for the new action.
Click Add Step.Note: An action can execute one or more steps in sequence. Each step is a built-in action or a custom action. Actions can evaluate variables to determine whether steps run.
Do one of the following:
Select the action name.
The selected action appears in the editor.
Create an If/Else expression to execute different branches of steps, based on the value of a variable
An if/else construct allows an action to execute different steps based on the runtime value of a variable.
Click If/Else. An expression editor appears.
Under Left Hand Side, select the variable whose runtime value compares with something else.
Next, select the Operator to use for the comparison.
Click the options menu for Right-Hand Side.
To select what to compare the Left Hand side variable to, choose Interpolated Text, Text Expression, or Variable.
- Interpolated Text: Evaluates a string that contains the runtime value of one or more placeholders.
- Text Expression: Compares with the result of a logical expression. See Dynamic variables.
- Variable: Compares with the runtime value of a variable.
Based on your selection, type text in the input box or choose a variable.
Click Add Step, and then choose a built-in or custom action to run when the expression evaluates True. Add any other steps to execute when the expression is True.
To define steps to take when the expression is False, click Add Step under Else. This process defines an alternate series of steps that the action can take, based on the value of the Left Hand Side variable.
Note: The bottom-most Add Step button performs a special function. It defines additions steps for the action to take after actions in the conditional expression run. In programming terms, this behavior is equivalent to lines of code that follow an if…then…else expression. These steps always execute when the action runs, regardless of the variable’s value.
A delay allows you to suspend the execution of an action for a specified amount of time.
Enter the amount of time to delay in milliseconds. From the options menu , choose whether that amount is as an integer, math expression, or variable.
Click Add Step.
A Try/On Error expression allows you to determine what happens if an error occurs when you attempt to do something.
Note: You cannot currently expose a variable that returns the actual error from the Try action.
- Click Try/On Error. An expression editor appears.
- Under Try, click Add Step, and then choose a built-in or custom action to execute. Add any other steps to execute when the expression is True.
- Under On Error, click Add Step, and then choose a built-in or custom action to execute when the Try action results in an error.
- Click Add Step.
An Add an Info Banner action allows you to display text to the agent for the amount of time the action take to execute.
- Click Info Banner. A text editor appears.
- Type or paste the text you want to appear in the banner.
- Click Add Step.
- Add other steps as needed.
- If you create multiple steps, you can use the up and down arrows to reorder them. Steps execute in top down order.
To finish, click Save.
- To delete a step, click Delete Step .
- To cut a selection, click Cut .
- To copy a selection, click Copy .
- To collapse an action, click Collapse .
- To open a collapsed action, click Expand
- To modify an existing custom action, click Edit Custom Action
- To convert an existing action to a custom action, from the action, click Convert to Custom Action .