Trigger Notification using Event

Gokul Nath
Kilo Sage
Spoiler
Spoiler
 

Hi all,

 

I have a requirement to trigger an notification if the SLA of the Demand task has been breached

 

1. To trigger notification on Day of the breach

 

2. To trigger after 2 days from the breach

 

3. To trigger after 24 hrs from the second notification

 

I have created a notification and event and planning to use BR with event queue

 

If used with original breach time how can the comparison be done? Should this be done with .addDays() method? If so how to also consider the schedule in this?

 

Any inputs or sample code would help a lot

Thanks in advance

1 REPLY 1

Mehta
Kilo Sage
Kilo Sage

@Gokul Nath  

 

You can use a schedule Job and glide the Task SLA table and Put condition to fetch records for demand and has breached. Then you the Below script to compare and triggered the event for Notification. 

var currentobj = gs.nowDateTime();  // current time
var CurrentDateTime = new GlideDateTime(currentobj);
var gdt = new GlideDateTime(gr.planned_end_time);  // breached time
gdt.addDays(2); // add 2 days
if(gdt.getdate() == currentDateTime.getDate())
{
trigger notification 
}
var gdt2 = new GlideDateTime(gr.planned_end_time);  // breached time
gdt2.addDays(3); // add 2 days
if(gdt2.getDate() == currentDateTime.getDate())
{
trigger notification
}

 

Please Mark it Correct, If it Resolves Your Query.