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

    Interface StateModel<T>

    Configuration for a State Model and all of its states, transitions, and conditions.

    The model is written to the table that matches the target table: change_request → chg_model, problem → prb_model, problem_task → prb_task_model, any other table → the base sttrm_model. Class-specific properties (availableInUI, recordPreset) only apply to change_request; defaultModel and description apply to the subclass tables.

    interface StateModel<T extends TableName> {
        $id: string | number | ExplicitKey<string>;
        $override?: Record<string, string | number | boolean>;
        active?: boolean;
        advancedSecurity?: boolean;
        availableFor?: (string | Record<"user_criteria">)[];
        availableInUI?: boolean;
        color?: string;
        defaultModel?: boolean;
        description?: string;
        itilChangeProcess?: "normal" | "standard" | "emergency";
        name: string;
        notAvailableFor?: (string | Record<"user_criteria">)[];
        protectionPolicy?: "read" | "protected";
        readRoles?: (string | Role)[];
        recordPreset?: string;
        stateField?: string & {} | ChoiceFieldKeys<T>;
        states?: Record<string, State>;
        table: T;
        taskType?: "model" | "general" | "rca";
        templateApprovalGroups?: (string | Record<"sys_user_group">)[];
        templateApprovalUsers?: (string | Record<"sys_user">)[];
        templateProposalAccess?: "read" | "write";
        transitions?: Transition[];
        writableFor?: (string | Record<"user_criteria">)[];
        writeRoles?: (string | Role)[];
    }

    Type Parameters

    Index

    Properties

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

    Set properties not directly supported by this API.

    active?: boolean

    Whether the model is active. Defaults to true.

    advancedSecurity?: boolean

    Enables User Criteria-based access control (availableFor/writableFor/notAvailableFor) on the model, in addition to readRoles/writeRoles. Defaults to false.

    availableFor?: (string | Record<"user_criteria">)[]

    User Criteria that grant read access to records using this model, in addition to readRoles. Only takes effect when advancedSecurity is enabled. Pass a user_criteria sys_id or a Record<'user_criteria'> reference.

    availableInUI?: boolean

    Whether the model appears in UI dropdowns. Applies to change_request (chg_model) only — set to false for system-assigned models. Defaults to true.

    color?: string

    Background color for this model, shown in Change calendar/board views (e.g. 'green' or a hex value like '#2E7D32'). Applies to change_request (chg_model) only.

    defaultModel?: boolean

    Marks this as the default model for the table. Maps to the class-specific default flag (default_change_model / default_prb_model / default_prb_task_model). Only one model per table should set this. Defaults to false.

    description?: string

    Description of the model. Stored only on the subclass tables (chg_model / prb_model / prb_task_model).

    itilChangeProcess?: "normal" | "standard" | "emergency"

    ITIL change process classification. Applies to change_request (chg_model) only.

    name: string

    Name of the state model (e.g. "Normal", "Emergency").

    notAvailableFor?: (string | Record<"user_criteria">)[]

    User Criteria explicitly excluded from this model, overriding availableFor/writableFor and any matching roles. Only takes effect when advancedSecurity is enabled. Pass a user_criteria sys_id or a Record<'user_criteria'> reference.

    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.
    readRoles?: (string | Role)[]

    Roles allowed to read records using this model. Pass Role references or role names.

    recordPreset?: string

    Template values applied when the model is assigned to a record. Applies to change_request (chg_model) only. When set, the plugin automatically enables apply_record_preset so the platform applies the preset on model assignment.

    stateField?: string & {} | ChoiceFieldKeys<T>

    The field on the table that holds the state value. Defaults to 'state'.

    states?: Record<string, State>

    Map of developer-chosen state keys to state configurations. Keys are referenced by transitions.

    table: T

    The table the model applies to. Determines which model table the records are written to.

    taskType?: "model" | "general" | "rca"

    Problem task type. Applies to problem_task (prb_task_model) only. Controls which kinds of tasks the model governs: 'general' for standard tasks, 'rca' for root-cause-analysis tasks, or 'model' for template tasks.

    templateApprovalGroups?: (string | Record<"sys_user_group">)[]

    Groups whose members can approve a proposed Template before it is published. Pass a sys_user_group sys_id or a Record<'sys_user_group'> reference.

    templateApprovalUsers?: (string | Record<"sys_user">)[]

    Users who can approve a proposed Template before it is published. Pass a sys_user sys_id or a Record<'sys_user'> reference.

    templateProposalAccess?: "read" | "write"

    Controls who may propose new Templates (sttrm_template records) for this model: 'read' allows anyone with read access to the model, 'write' restricts proposal to those with write access. Applies to all model tables, independently of advancedSecurity.

    transitions?: Transition[]

    Valid transitions between states, with optional gating conditions. Omit for a model-only update.

    writableFor?: (string | Record<"user_criteria">)[]

    User Criteria that grant write access to records using this model, in addition to writeRoles. Only takes effect when advancedSecurity is enabled. Pass a user_criteria sys_id or a Record<'user_criteria'> reference.

    writeRoles?: (string | Role)[]

    Roles allowed to write records using this model. Pass Role references or role names.