how can i trigger a notification when the due date is breached and date changes

naveen14
Kilo Guru

Hi All,

Can u please help me " when the due date is completed after that the email should be send as notification by using date" .

3 REPLIES 3

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

use the solution provided here, it should work fine:

https://community.servicenow.com/community?id=community_question&sys_id=df613bbfdbaddb0047c8f3231f96...

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

Omkar Joshi
Giga Guru

Hi Naveen,

You need to create:

1.Event

2. Notification

3.Schedule Job

 

 

Trigger notification through the event.

 

Add the below script in your Scheduled Job.

 

var table=new GlideRecord('table')//Add your table name.

      table.query();

 

while(table.next())

var currentDate=new GlideDateTime();

var dueDate=new GlideDateTime(current.duedate);//check your variable name(due date)

 

var diff=gs.dateDiff(currentDate,dueDate);

if(diff==1)//if difference of current date and due date is 1 then

{

gs.eventQueue('Event name',table);

}

 

AbhishekGardade
Giga Sage

Do below Steps:

1.Create an event in Event Registry. let’s say Event Name is “u_off_hold_date.reminder" on incident table.

2.Create a business rule with Run conditions. Let say Due date CHANGES AND add following code:

var dueDate = current.due_date ; // replace due_date  with your field name

gs.eventQueueScheduled ("u_off_hold_date.reminder" , current , gs.getUserID(), gs.getUserName(), dueDate);

3. Create/ Modify your notification as below to send this mail on date: 

In the Event name , select a event name that you have created.

find_real_file.png

 

Read this more details,

eventQueueScheduled(String name, Object instance, String parm1, String parm2, Object expiration)

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade