@servicenow/sdk - v4.7.0
    Preparing search index...

    Interface ScriptAction

    interface ScriptAction {
        $id: string | number | ExplicitKey<string>;
        $meta?: { installMethod?: "first install" | "demo" | "once" };
        $override?: Record<string, string | number | boolean>;
        active?: boolean;
        conditionScript?: string | ((...args: unknown[]) => void);
        description?: string;
        eventName: string;
        name: string;
        order?: number;
        protectionPolicy?: "read" | "protected";
        script: string | ((...args: any[]) => void);
    }
    Index

    Properties

    $id: string | number | ExplicitKey<string>
    $meta?: { installMethod?: "first install" | "demo" | "once" }

    Type Declaration

    • OptionalinstallMethod?: "first install" | "demo" | "once"

      Map a record to an output folder that loads only in specific circumstances. 'first install' -> 'unload' (only loaded when plugin is first registered), 'demo' -> 'unload.demo' (only loaded when demo data is loaded), 'once' -> 'apply_once' (scripts that are only applied once)

    $override?: Record<string, string | number | boolean>

    Set properties not directly supported by this API.

    active?: boolean

    Enable or disable the Script Action. Defaults to false.

    conditionScript?: string | ((...args: unknown[]) => void)

    Statement for a condition under which this script should execute. The system only parses the script field if the condition evaluates to true. If you decide to include the condition statement in the script, leave this field blank

    description?: string

    Documentation explaining the purpose and function of the Script Action

    eventName: string

    Event to use for this script action. If you do not find an event for your script action that suits your purpose, you can create a new one

    name: string

    Unique name for your Script Action

    order?: number

    Order in which the script will be executed

    protectionPolicy?: "read" | "protected"

    Controls edit/view access for other developers after the application is installed.

    • read: Others can see the script logic but not change it.
    • protected: Others cannot change this record.
    • Omit to allow other developers to customize this record.
    script: string | ((...args: any[]) => void)

    Script that runs when the condition you define evaluates to true. Two additional objects are available in this script:

    • event: a GlideRecord - the sysevent that caused this to be invoked. If you want this first parameter on the event, use event.parm1 or event.parm2 for the second parameter. For the date/time of the event, use event.sys_created_on. To get the user ID that created the event (if there was a user associated), use event.user_id.
    • current: a GlideRecord - the event scheduled on behalf of (incident for example). Consider using a function exported from your src/server modules or using Now.include() to move the script to a separate js file