Skip to main content
Version: Latest (4.5.0)

Function: EmailNotification(config)

Creates an email notification configuration for ServiceNow. Email notifications are automated messages sent to users when specific conditions are met, such as record updates, insertions, or system events.

This API allows you to define notifications with trigger conditions, recipient targeting, email content, and digest options. Notifications can be triggered by database operations (insert/update), system events, or manual execution.

Parameters

config

EmailNotification<keyof Tables>

Email notification configuration object

Properties:

  • table (required): keyof Tables The table that this notification applies to (required)

  • active (optional, default: true): boolean Whether the notification is active and will be sent

  • category (optional, default: 'c97d83137f4432005f58108c3ffa917a' (Default email category)): string | Record<'sys_notification_category'> Category for organizing and managing notifications

  • description (optional): string Description of the email notification

  • digest (optional): Digest Digest configuration for batching multiple notifications

  • emailContent (optional): EmailContent Email content and formatting options

  • enableDynamicTranslation (optional, default: false): boolean Whether to enable dynamic translation of notification content

  • mandatory (optional, default: false): boolean Whether the notification is mandatory and cannot be unsubscribed from

  • name (optional): string Name of the email notification

  • notificationType (optional, default: 'email'): 'email' | 'vcalendar' Type of notification: email or calendar invite (vcalendar)

  • recipientDetails (optional): RecipientDetails Configuration for who receives the notification

  • triggerConditions (optional): TriggerConditions<keyof Tables> Conditions that determine when the notification is triggered

Examples

Basic Email Notification Example

Create an email notification that fires when an incident is inserted or updated

/**
* @title Basic Email Notification Example
* @description Create an email notification that fires when an incident is inserted or updated
*/

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

export const IncidentCreatedNotification = EmailNotification({
$id: Now.ID['incident-created-notification'],
table: 'incident',
name: 'Incident Created Notification',
description: 'Notify assigned user when an incident is created or updated',
active: true,
triggerConditions: {
onRecordInsert: true,
onRecordUpdate: true,
},
recipientDetails: {
recipientFields: ['assigned_to'],
},
emailContent: {
subject: 'Incident ${number}: ${short_description}',
messageHtml:
'<p>An incident has been created or updated.</p><p>Number: ${number}</p><p>Priority: ${priority}</p>',
},
})