Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to customize notification email subject with dynamic date/time in ServiceNow OHS Incident table?

Satyam123
Tera Contributor

 

Hi Community,

I am working on a Health and Safety catalog item in ServiceNow.

When a user submits the catalog item from the Service Portal, an incident record is created in the sn_ohs_im_incident table, and a notification email is triggered.

I need to customize the email subject dynamically.

Currently, I want the subject to be in the following format:

Tuesday, September 1, 2026 1:30 PM

Where:

  • Tuesday, September 1, 2026 1:30 PM → dynamic date/time from the incident record

I tried using notification variables such as ${number} and ${sys_created_on}, but I need the date/time in this exact format:

Day of Week, Month DD, YYYY H:MM AM/PM

For example:

Tuesday, September 1, 2026 1:30 PM

Questions:

  1. What is the recommended way to achieve this in a ServiceNow Notification?

  2. Should I use a Mail Script to format sys_created_on?

  3. Is there a better approach using a Script Include or a field on sn_ohs_im_incident?

  4. How can I ensure the date/time respects the user's/time zone's expected display format?

Any guidance or sample code would be appreciated.

Thanks!

1 REPLY 1

drbob
Tera Guru

It sounds like a mail script to me but before that... your description seems contradictory - you say the day/time has to be in that exact format but then you want to ensure that it respects the user's display format. How can it be both if the user has picked anything other than the one you stated ?