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

    Interface SPWidget<Table>

    interface SPWidget<Table extends TableName = "sp_instance"> {
        $id: string | number | ExplicitKey<string>;
        $meta?: { installMethod?: "first install" | "demo" | "once" };
        $override?: Record<string, string | number | boolean>;
        angularProviders?: (
            string
            | SPAngularProvider
            | Record<"sp_angular_provider">
        )[];
        category?:
            | "standard"
            | "custom"
            | "sample"
            | "otherApplications"
            | "knowledgeBase"
            | "servicePortal"
            | "serviceCatalog";
        clientScript?: string;
        controllerAs?: string;
        customCss?: string;
        dataTable?: Table;
        demoData?: JsonSerializable;
        dependencies?: (string | SPWidgetDependency | Record<"sp_dependency">)[];
        description?: string;
        docs?: string | Record<"sp_documentation">;
        fields?: (string & {} | SystemColumns | keyof FullSchema<Table>)[];
        hasPreview?: boolean;
        htmlTemplate?: string;
        id?: string;
        internal?: boolean;
        linkScript?: string;
        name: string;
        optionSchema?: WidgetOption[];
        protectionPolicy?: "read" | "protected";
        public?: boolean;
        roles?: (string | Role | Record<"sys_user_role">)[];
        serverScript?: string;
        servicenow?: boolean;
        templates?: SPTemplate[];
    }

    Type Parameters

    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.

    angularProviders?: (string | SPAngularProvider | Record<"sp_angular_provider">)[]

    Array of Angular providers for the widget

    category?:
        | "standard"
        | "custom"
        | "sample"
        | "otherApplications"
        | "knowledgeBase"
        | "servicePortal"
        | "serviceCatalog"

    The category of the widget (default is 'custom')

    clientScript?: string

    The client script for the widget

    controllerAs?: string

    The controller for the widget (default is 'c')

    customCss?: string

    The custom CSS for the widget

    dataTable?: Table

    The data table for the widget (default is 'sp_instance')

    demoData?: JsonSerializable

    The demo data for the widget

    dependencies?: (string | SPWidgetDependency | Record<"sp_dependency">)[]

    Array of widget dependencies

    description?: string

    The description of the widget

    docs?: string | Record<"sp_documentation">

    The documentation for the widget

    fields?: (string & {} | SystemColumns | keyof FullSchema<Table>)[]

    The fields for the widget

    hasPreview?: boolean

    Show the preview pane in the Service Portal editor

    htmlTemplate?: string

    The HTML template for the widget

    id?: string

    The unique id for the widget. Must contain alphanumeric, -, or _ characters

    internal?: boolean

    internal field used by ServiceNow developers

    linkScript?: string

    The link script for the widget (client-side)

    name: string

    The name of the widget (required)

    optionSchema?: WidgetOption[]

    The option schema for the widget

    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.
    public?: boolean

    Whether the widget is public

    roles?: (string | Role | Record<"sys_user_role">)[]

    The roles that can access the widget

    serverScript?: string

    The server script for the widget

    servicenow?: boolean

    Built by ServiceNow. On build, can only be true if scope has sn_ or snc_ prefix

    templates?: SPTemplate[]

    Array of widget templates