Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Script Action utility

Use the Script Action utility in a Virtual Agent topic to run a script.

Script Action utility properties

PropertyDescription
Node nameThe name that identifies this Script Action node in the topic flow.
Action expressionThe script that performs an action.
Advanced
Hide this node
Conditionally show this node ifNo-code condition statement or low-code script that specifies a condition for presenting this node in the conversation. The condition must evaluate to true.

Example Script Action utility

Image omitted: ScriptActionExample.png
Basic properties include the node name and the action expression that contains the script.

Example script action

(function execute() {
    var list = [];
    if (vaInputs.case_number != "") {
        var gr = new GlideRecord("sn_customerservice_case");
        gr.addQuery("number", "CONTAINS", vaInputs.case_number);
        gr.addQuery("active", "true");
        gr.orderBy("number");
        gr.query();
        while (gr.hasNext()) {
            gr.next();
            list.push(gr.getUniqueValue().toString());
        }
    }
    vaVars.case_list = list;
})()

This example performs a search on the [sn_customerservice_case] table for a specific case number based on the input from another control called case_number. The script then places the results in an array and stores them in the case_list variable, which is accessible by other nodes in the same topic. Because vaVars only supports string, number, and Boolean values, the script uses toString() to store these values as strings. The code is contained in an if statement, so it only executes if the case_number variable has a value. This if statement prevents the code from running if the user has not entered a number.

For more information about writing scripts for Virtual Agent, see Virtual Agent scripts.

Parent Topic:Assistant Designer utilities