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

    Type Alias AliasTemplate

    AliasTemplate: WithIdAndMetadata<
        {
            defaultDataTemplate: DefaultDataTemplate;
            dynamicDataSchema: DynamicDataSchema;
            name: string;
            onEditScript?: string
            | AliasTemplateScriptFn<void>;
            postProcessScript?: string | AliasTemplateScriptFn<void>;
            preEditScript?:
                | string
                | AliasTemplateScriptFn<{ name: string; value: unknown }[]>;
            testAction?:
                | string
                | Record<"sys_hub_action_type_definition">
                | ReturnType<typeof Action>;
        },
    >

    Creates a Connection & Credential alias template (sys_alias_templates): a reusable definition that controls the form fields and default values shown when a user sets up a connection alias on the ServiceNow platform. Templates drive the wizard UI that collects connection URLs, credentials, and other integration settings.

    The alias template configuration including dynamic data schema, default data template, and optional scripts for form lifecycle events

    The template configuration object

    import { AliasTemplate } from '@servicenow/sdk/core'

    export const MyHttpTemplate = AliasTemplate({
    $id: Now.ID['my-http-template'],
    name: 'My HTTP REST Template',
    dynamicDataSchema: {
    connectionFields: [
    { name: 'connectionUrl', label: 'Base URL', type: 'text', mandatory: true },
    ],
    credentialFields: [
    { name: 'username', label: 'Username', type: 'text', mandatory: true },
    { name: 'password', label: 'Password', type: 'password', mandatory: true },
    ],
    },
    defaultDataTemplate: {
    connection: { table: 'http_connection', name: 'My HTTP Connection', connectionUrl: 'https://api.example.com' },
    credential: { table: 'basic_auth_credentials', name: 'My HTTP Credential' },
    },
    })