@servicenow/sdk - v4.14.3
    Preparing search index...
    interface UiMacro {
        $id: string | number | ExplicitKey<string>;
        $meta?: {
            installMethod?: "first install" | "demo" | "once";
            useEsLatest?: boolean;
        };
        $override?: Record<string, string | number | boolean>;
        active?: boolean;
        category?: "" | string & {} | "catalog" | "general" | "layout" | "cms";
        description?: string;
        mediaType?: string;
        name: string;
        protectionPolicy?: "read" | "protected";
        xml?: string;
    }
    Index

    Properties

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

    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)

    • OptionaluseEsLatest?: boolean

      Controls whether this record's server-side script field(s) run with the latest supported ECMAScript version rather than the application's default. Omit to leave the sys_app/now.config default in place. This setting applies to all fields defined for this entity

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

    Set properties not directly supported by this API.

    active?: boolean

    Set to false to disable the macro without deleting it.

    true
    
    category?: "" | string & {} | "catalog" | "general" | "layout" | "cms"

    Category used to group and filter macros in the UI Macro list, e.g. 'catalog' for Service Catalog variable and cart macros. Use '' to explicitly clear the category on a record that previously had one set. This is a choice field on the platform, not free text — the listed values are the known choices, but the SDK still accepts any other string for forward compatibility with choices added later.

    'general'
    
    description?: string

    Free-text notes for other developers, shown on the macro's record form (not rendered at runtime). UI Macros have no typed parameter list, so document the Jelly variables the macro accepts here — it's the only parameter documentation other developers see. Empty by default.

    mediaType?: string

    Optional device type/variant lookup key — not an HTTP MIME type. Omit it for standard UI Macros and form formatters: MIME-style values such as 'text/html' are never matched by the platform's device-type macro lookup, so the macro silently fails to resolve at render time; the build produces a warning. Empty by default.

    name: string

    Local name of the UI Macro, without the scope prefix. Choose a distinctive name: the platform rejects saving an active macro whose name and mediaType match another active macro anywhere on the instance, in any scope. Two macros in the same project with the same name and mediaType are a build error; collisions with macros outside the project only surface at install time.

    In scoped applications, invoke the macro with the scope-qualified tag, e.g. <g:x_myapp_alert_banner /> for a macro named alert_banner in scope x_myapp. Including the scope prefix in name yourself produces a build warning, and <scope>_<name> longer than 100 characters is a build error.

    Renaming a macro updates the existing record in place (it is identified by $id), but update every <g:...> invocation that uses the old name.

    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.
    xml?: string

    Jelly XML content defining the macro behavior. Prefer Now.include() to keep the Jelly in a separate .jelly.xml file, which avoids escaping every ${...} expression:

    xml: Now.include('./my-macro.jelly.xml')
    

    The build reports malformed XML (mismatched or unclosed tags, bare < or & in element text) as a warning; the content is still written as-is. Attribute values and runtime Jelly errors are not checked at build time. See the jelly-guide topic for Jelly phases, caching, and XML-safe script content.

    Empty by default.