How to send email reminders in ServiceNow

Use Case

If active incident is not updated in last 7 days then user in assigned to field should get reminder to update the ticket with latest status.


Solution

ServiceNow can send reminder emails by using scheduled jobs which can generate event once condition is matched as per the query of records.

You can use gs.eventQueue() method for generating event in script.


Method : gs.eventQueue(name,record,parm1,parm2,queue)

Parameters :

  • name - Name of the event to be generated. This event can be created in Event Registry.

  • record - current record or glide record. Example - gr or current

  • parm1 - Parameter to be used in scripting or sending email. Example - gr.assigned_to.email

  • parm2 - Another Parameter. Example - gr.number

  • queue- Provide queue name else leave empty for custom queue

What elements need to be created

  • Create a Scripted Schedule

  • Create an Event in Event Registry

  • Create a Notification

Create a Scheduled Job for Script Execution

  • Go to System Definitions > Scheduled Jobs

  • Create New Scheduled Job

  • Click on Automatically run a script of your choosing.

  • Fill fields

  • Name: send.reminder.email

  • Run: Daily

  • Time Zone : As per your requirement

  • Script :

var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^sys_updated_on<javascript:gs.beginningOfLast7Days()');
gr.query();
while(gr.next())
	{
		gs.eventQueue('inc.sendreminder',gr,gr.assigned_to.email,gr.number);
		
	}

Create an event record in Event Registry

  • Go to System Policy > Events > Registry


  • Create new Event

  • Name as inc.sendreminder

  • Save the form

Create Email Notification

  • Go to System Notifications > Emails > Notifications

  • Create New Notification

  • Provide the name

  • Select Incident table

  • Select Send When as Event is Fired

  • Event Name should be the event you have created in event registry. In this case it is inc.sendreminder

  • You can provide other details like who will recieve and content of email

  • Save the form

You are Done!

This way you can send reminders to different people if tickets are not getting updated.



320 views0 comments

Recent Posts

See All

How to create custom popup alert box?

This will show you how can you create custom popup with designer buttons by using Glide Modal in ServiceNow. Use Case An alert popup always shows default browser alert which is added by adding alert()