---
sourceDocument: Zurich Conversational Interfaces
sourceDocumentLink: https://www.servicenow.com/docs/r/zurich/conversational-interfaces

 Release :

    - zurich

ft:locale :

    - en-US

ft:publication_title :

    - Zurich Conversational Interfaces

ft:clusterId :

    - convint

bundleId :

    - convint

workflow :

    - Platform


---

# Script Action utility

# Script Action utility {#ariaid-title1}

* Release version: Zurich
* 
* Updated July 31, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

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

## Script Action utility properties {#va-script-action__section_xwb_mgn_pdb}

{#va-script-action__table_nff_y1b_3db__entry__2}

| Property | Description |
|-|-|
| Node name | The name that identifies this Script Action node in the topic flow. |
| Action expression | The script that performs an action. |
| Advanced ||
| Hide this node ||
| Conditionally show this node if | No-code condition statement or low-code script that specifies a condition for presenting this node in the conversation. The condition must evaluate to true. |
[ ]

{#va-script-action__table_nff_y1b_3db}

## Example Script Action utility {#va-script-action__section_jxd_nh5_tdb}

Figure 1. Script Action utility basic properties

## Example script action {#va-script-action__section_uns_jkm_vdb}

    (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](https://www.servicenow.com/docs/UvxJFy7emVLY884mBVLg4w "Use ServiceNow Virtual Agent script methods and variables to write chat scripts, such as response, trigger, and flow scripts. Variables can also provide context for your live support topics and conversations.").

