Tips & Tricks

Simple Notification Templating

Whilst ServiceNow has some email templating functionality, I found that it’s was fairly limited and meant that reproduction of work on a regular basis was required. Instead I decided to create a header and footer template that could be reused time and time again. and moreover, a template which was dynamic to the table that the notification was triggered from.

How did I achieve this? with Mail Scripts.

by using mail scripts, I can now create notifications that contain a header and a footer simply by including ${mail_script:generic.communication.header} at the top and ${mail_script:generic.communication.footer} at the bottom.

Determining the table name is pretty easy, we just need to put it into a format that makes it look nicer than it’s in the database as.

Once you’ve got that you can just use template.print() to add HTML to the body of the email, your HTML will look messy in here as it needs to all be on one line. but the result is an email notification template that can be used over and over again throughout your ServiceNow instance, including within workflows that you might use.


Leave a Reply

Your email address will not be published. Required fields are marked *