How to send notification when due date reached

chanikya
Tera Guru

Hi,

here i have one typical task that is send notification when Due date and time reached

Ex: in incident table i have 5 incidents

first ---> due date 26-04-2018 16:00:00      send notification exact at      26-04-2018 16:00:00

second--->due date 26-04-2018 13:20:00   send notification exact at   26-04-2018 13:20:00 

third--->due date 26-04-2018 18:00:00

fourth--->due date 26-04-2018 17:40:00

fifth--->due date 26-04-2018 16:10:00      all incidents are 26-04-2018 but time is different so is it possible to send notification based on Date & time   when it match with   current Date & Time......   

1 ACCEPTED SOLUTION

Archana Reddy2
Tera Guru

Hi,

Try creating an insert/update Business Rule as below.

gs.eventQueueScheduled('event.name',current,gs.getUserID(),gs.getUserName(),current.u_due_field_name);

Before this, create an event with name as event.name and create a notification to be sent when this event fires.

In the notification, check Event parm 1 contains recipient and Event parm 2 contains recipient.

Hope this solves your issue.

Thanks,

Archana

 

View solution in original post

13 REPLIES 13

Thanks Archana!!!

Thanks for your reply

as well as we should create Business Rule on sysevent table to delete previous events in Queue...

 

Ans: Create Business Rule, create an event, create notification, create BR on event table

BR Script:

Table: u_hr_form,                                             when to run: insert(only) ,   before

Scriptgs.eventQueueScheduled('alert_due',current,current.u_approver,'',current.u_alert_due);

 

 

BR: Delete duplicate events trigger cookies

Table: u_hr_form ,             when to run: update(only) , before      condition: AlertDue changes

Script:

var gr = new GlideRecord('sysevent');

gr.addQuery('state', 'ready'); // We only want the event in the ready state

gr.addQuery('name', 'alert_due'); // Change the event name to the event name you are using

gr.addQuery('table', 'u_hr_form');

gr.addQuery('instance', current.sys_id); // Get the event that has been created for this record

gr.query();

while(gr.next()){

                gr.deleteRecord();

}

gs.eventQueueScheduled('alert_due',current,current.u_approver,'',current.u_alert_due);

               

This worked. Right?

 

yes...it is working..!!

Awesome, pick someone's response to mark this as answered.