Email notification will trigger after 30 days when incident closed how we can approach?

soft
Kilo Contributor

Email notification will trigger after 30 days when incident closed how we can approach?

5 REPLIES 5

Deepak Ingale1
Mega Sage

You can create a schedule job which will run daily, it will find all the incidents closed 30 days ago, then you can fire an event for every incident. This event can be used to send notifications.


Hi Deepak,



can u explain regarding script?


Mihir Mohanta
Kilo Sage

Hi Srinivas,



There is an OOB closed_at field in the incident table . Set value to that field when incident is closed.



1.Create an event with name "incident.closed" .


2.Send notification when that event triggers.


3.Create a scheduled job that will trigger event daily basis.



Your script should be like below :



var qrystr = "closed_atBETWEENjavascript:gs.daysAgo(-29)@javascript:gs.daysAgo(-30)";


var expdt = new GlideRecord("incident");


expdt.addEncodedQuery(qrystr);


gs.log("Incident count " + expdt.getRowCount());


while(expdt.next())


  {


gs.eventQueue("incident.closed", expdt, expdt.caller_id, expdt.caller_id.name);


}



Please mark it as Helpful/Correct if it helps



Thanks,


Mihir


Deepak Ingale1
Mega Sage

Hi Sri,



Mihir has already provided the script, you can give it a try, it should work