Inbound Email Actions let ServiceNow automatically process incoming emails and create or update records based on what it finds. You'll build an action that triggers on specific conditions and runs your custom logic against the email content.
What manual email processing looks like
Before Email Actions, teams manually processed incoming emails — someone reads support requests in Outlook, copies details into ServiceNow incidents, tries to match senders to users, and updates existing tickets when customers reply. This creates delays, inconsistent data entry, and missed emails. The people doing this work — service desk agents and admins — spend hours on data entry instead of solving problems. Email Actions replace this manual workflow by automatically parsing emails and executing your business logic.
How Email Actions process messages
An Inbound Email Action is a record that contains conditions (when to fire) and a script (what to do). ServiceNow evaluates actions in weight order against each incoming email. If conditions match, the script runs with access to an email object containing the sender, subject, body, and attachments. Your script typically queries for existing records, creates new ones, or updates fields based on email content. The 'Stop processing' flag determines whether ServiceNow should evaluate additional actions after yours fires.
Building production-quality email processing
Start with a simple action that creates records from specific sender addresses. Then add email parsing to extract structured data from message bodies, duplicate detection to prevent multiple records from the same conversation, and error handling for malformed emails. Production implementations use multiple actions with different weights to handle various email types, integrate with external systems for sender validation, and include logging for troubleshooting failed processing.
Before you start
- •admin role or inbound_email_action_admin role
- •Email configured in System Mailboxes with inbound processing enabled
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
Create the Email Action record
Navigate to System Notification > Email > Inbound Email Actions and click New. Set the Name to describe what this action does — 'Create Incident from Support Email' or 'Update Task from Status Email'. Set Weight to 100 (or higher than existing actions if this should run first). Leave Active checked.
Lower weight numbers run first — use multiples of 100 so you can insert actions between existing ones later.
Configure the processing conditions
Set Type to 'receive' for incoming emails. In the Condition field, write JavaScript that returns true when this action should fire: 'email.subject.indexOf('[URGENT]') >= 0' or 'email.sender_email.endsWith('@customer.com')'. Check 'Stop processing' if no other actions should run after this one matches.
Test conditions with simple string matching first — complex regex parsing can be added once the basic action works.
Write the action script
In the Script field, write JavaScript that processes the email. Use 'email.subject' for the subject line, 'email.body_text' for plain text content, 'email.body_html' for HTML content, and 'email.caller_id' for the sender's sys_id (if they're a ServiceNow user). Create or update records using standard GlideRecord operations. Common pattern: var inc = new GlideRecord('incident'); inc.initialize(); inc.short_description = email.subject; inc.description = email.body_text; inc.caller_id = email.caller_id; inc.insert();
Handle sender identification
Add logic to find or create users based on email addresses. If email.caller_id is empty (sender not in ServiceNow), query the sys_user table by email: var user = new GlideRecord('sys_user'); user.addQuery('email', email.sender_email); user.query(); if(user.next()) { inc.caller_id = user.sys_id; }. For external senders, either create user records or use a default 'External User' account.
Add duplicate prevention
Check for existing records before creating new ones. Extract ticket numbers from subject lines or use email message IDs to avoid duplicates. Pattern: if(email.subject.indexOf('INC') >= 0) { var match = email.subject.match(/INC\d{7}/); if(match) { /* update existing incident */ } } else { /* create new incident */ }. Save the Email Action record.
Test with sample emails
Send test emails to your configured mailbox that match your conditions. Check System Logs > Email for processing results and any script errors. Verify records are created correctly and contain expected values. Use 'Preview Script Usage' on the action record to see available email object properties during development.
Best practices
Always check if email.caller_id exists before using it — external senders won't have ServiceNow user records.
Use email.body_text instead of email.body_html for parsing unless you specifically need HTML formatting — plain text is more reliable.
Set specific conditions rather than broad catches — an action that fires on every email will create performance problems.
Log important processing steps using gs.info() so you can troubleshoot failed email processing later.
Test your action with forwarded emails and replies — email clients add headers and formatting that can break simple parsing logic.
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