The alias template configuration including dynamic data schema, default data template, and optional scripts for form lifecycle events
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' },
},
})
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.