Notification emails need dynamic data — the ticket number, assignee name, or custom field values from the record. This guide shows you how to pull that data into email bodies using ServiceNow's variable syntax.
Why static email templates don't work
Before variables, email notifications were static text that told users something changed but not what changed. Users had to log back into ServiceNow to see the incident number, who it was assigned to, or what the requester actually asked for. The people receiving these emails — end users, managers, and fulfillment teams — got notifications that created more work instead of providing the information they needed to act.
How notification variables work
ServiceNow processes email templates by replacing ${variable_name} placeholders with actual data from the triggering record. Direct field references like ${number} and ${assigned_to} pull from the current table. Dot-walked references like ${caller_id.email} traverse relationships to pull data from related records. For complex logic, ${mail_script:script_name} calls server-side JavaScript that returns formatted strings. The platform automatically converts reference fields to display values, so ${assigned_to} shows 'John Smith' instead of a sys_id.
Building production-quality email content
Start with the essential fields users need — record number, state, assignment. Add context like descriptions or custom field values that help recipients understand what happened. For advanced formatting, create mail scripts that handle conditional logic, calculations, or complex data presentation. Well-designed email notifications reduce clicks back to the platform and provide enough context for quick decisions.
Before you start
- •notification_admin or admin role
- •Existing notification record to modify
Sourdough: ServiceNow Monitoring and Analytics
A Chrome extension for ServiceNow Admins and Developers with essential tools, analytics, graphs and monitoring features.
Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.
Step by step
Open your notification record
Navigate to System Notification > Email > Notifications and open the notification you want to modify. Click into the Message HTML field where you'll add the variable syntax. The HTML editor gives you both design view and source code access.
Use the HTML source view for precise variable placement — the design view sometimes adds unwanted formatting around variables.
Add direct field variables
Insert ${field_name} syntax for fields on the triggering record. Common examples: ${number} for the record identifier, ${state} for workflow status, ${short_description} for the summary. Type the exact field name from the table schema — ${assigned_to} works, ${assignee} doesn't.
Right-click any field in a form and select 'Show XML' to see its exact field name for variable syntax.
Add dot-walked reference fields
Use ${table.reference_field.target_field} to pull data from related records. Examples: ${caller_id.email} gets the caller's email address, ${assignment_group.manager} gets the group manager's name, ${cmdb_ci.location.name} walks from CI to location name. Each dot represents a relationship hop.
Test variable resolution
Save the notification and trigger it with a test record that has data in the fields you're referencing. Check that variables resolve to actual values, not sys_ids or empty placeholders. Reference fields should show display values automatically without additional formatting.
Add mail script for complex logic
Create a Notification Mail Script (System Notification > Email > Notification Mail Scripts) for calculations, conditional text, or formatted lists. Write server-side JavaScript that returns a string, then reference it with ${mail_script:your_script_name}. The current record is available as 'current' in the script.
Format the email layout
Structure your variables in readable HTML with labels and context. Use tables for structured data, paragraphs for descriptions, and headers to organize sections. Include both the field label and variable: 'Assigned to: ${assigned_to}' instead of just the variable alone.
Best practices
Always test dot-walked variables with records that have complete reference chains — null references in the middle break the entire variable.
Don't dot-walk more than 3 levels deep in email templates — performance degrades and the variables become brittle when data relationships change.
Use mail scripts instead of complex dot-walking for any logic beyond simple field display — conditional formatting and calculations belong in JavaScript, not template syntax.
Include fallback text in mail scripts for empty reference fields — emails with blank sections look broken to recipients.
Reference the 'number' field instead of 'sys_id' in email templates — users recognize ticket numbers, not GUIDs.
Test Your Knowledge
Quick 3-question quiz — see how your ServiceNow skills stack up.
A list view on a table with millions of records is slow. Best fix?
Select an answer to continue