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

    Interface BusinessRule<T>

    interface BusinessRule<T extends TableName> {
        $id: string | number | ExplicitKey<string>;
        $meta?: { installMethod?: "first install" | "demo" };
        abort_action?: boolean;
        abortAction?: boolean;
        access?: "public" | "package_private";
        action?: ("update" | "delete" | "insert" | "query")[];
        active?: boolean;
        add_message?: boolean;
        addMessage?: boolean;
        changeFields?: boolean;
        clientCallable?: boolean;
        condition?: string;
        description?: string;
        executeFunction?: boolean;
        filter_condition?: string;
        filterCondition?: string;
        message?: string;
        name: string;
        order?: number;
        priority?: number;
        protectionPolicy?: "read" | "protected";
        rest?: {
            method?: string | Record<"sys_rest_message_fn">;
            methodText?: string;
            service?: string | Record<"sys_rest_message">;
            serviceText?: string;
            variables?: string;
            webService?: boolean;
        };
        role_conditions?: (string | Role)[];
        roleConditions?: (string | Role)[];
        script?:
            | string
            | ((current: any, previous: any, ...dependencies: any[]) => void);
        set_field_value?: string;
        setFieldValue?: string;
        sys_policy?: "read" | "protected";
        table: T;
        when?: "before" | "after" | "async" | "async_deprecated" | "display";
    }

    Type Parameters

    Index

    Properties

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

    Type Declaration

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

      Map a record to an output folder that loads only in specific circumstances. 'first install' - > 'unload', 'demo' -> 'unload.demo'

    abort_action?: boolean

    Whether to abort the current database transaction

    abortAction?: boolean

    Whether to abort the current database transaction

    access?: "public" | "package_private"

    Is this rule accessible from all scopes or just this scope: Default: package_private

    action?: ("update" | "delete" | "insert" | "query")[]

    The database operations that trigger this business rule

    active?: boolean

    Whether the business rule is enabled

    add_message?: boolean

    Whether to display a message when the business rule runs

    addMessage?: boolean

    Whether to display a message when the business rule runs

    changeFields?: boolean

    Update reference fields. Default: false

    clientCallable?: boolean

    Is this rule callable by client scripts? Default: false

    condition?: string

    Script-based condition that must evaluate to true for the business rule to run

    description?: string

    Description of the business rule's purpose

    executeFunction?: boolean

    Automatically execute the function predefined for this type of business rule (onBefore, onAfter, etc). Default: false

    filter_condition?: string

    Condition-builder conditions that must be met for the business rule to run

    filterCondition?: string

    Condition-builder conditions that must be met for the business rule to run

    message?: string

    The message to display when add_message is true

    name: string

    The name of the business rule

    order?: number

    The execution order of the business rule (lower numbers execute first)

    priority?: number

    Sets priority value for async rules

    protectionPolicy?: "read" | "protected"

    The policy determines whether someone can view or edit the business rule after the application is installed on their instance.

    • read: Allow other application developers to see your script logic, but not to change it.
    • protected: Prevent other application developers from changing this business rule.
    • undefined Allow other application developers to customize your business rule.
    rest?: {
        method?: string | Record<"sys_rest_message_fn">;
        methodText?: string;
        service?: string | Record<"sys_rest_message">;
        serviceText?: string;
        variables?: string;
        webService?: boolean;
    }

    REST properties for rule

    Type Declaration

    • Optionalmethod?: string | Record<"sys_rest_message_fn">

      Reference to a HTTP Method

    • OptionalmethodText?: string
    • Optionalservice?: string | Record<"sys_rest_message">

      Reference to a REST Message

    • OptionalserviceText?: string
    • Optionalvariables?: string

      Rest Variables

    • OptionalwebService?: boolean

      (is_rest) Whether this rule is associated with an outbound REST. Default: false

    role_conditions?: (string | Role)[]

    Roles that the user must have for the business rule to execute

    roleConditions?: (string | Role)[]

    Roles that the user must have for the business rule to execute

    script?:
        | string
        | ((current: any, previous: any, ...dependencies: any[]) => void)

    The script to execute, receives current and previous GlideRecords as arguments.

    set_field_value?: string

    Field values to set in the current record

    setFieldValue?: string

    Field values to set in the current record

    sys_policy?: "read" | "protected"

    The policy determines whether someone can view or edit the business rule after the application is installed on their instance.

    • read: Allow other application developers to see your script logic, but not to change it.
    • protected: Prevent other application developers from changing this business rule.
    • undefined Allow other application developers to customize your business rule.
    table: T

    The table on which the business rule runs

    when?: "before" | "after" | "async" | "async_deprecated" | "display"

    When the business rule should be executed relative to the database transaction