Trigger email when no incident created in last 30 min

Harsha Bharamb1
Tera Contributor
 
5 REPLIES 5

Harsha Bharamb1
Tera Contributor

I have created scheduled job and added below mentioned script:

var incident = new GlideRecord('incident');

incident.addEncodedQuery('active=true^sys_created_onRELATIVEGT@minute@ago@30');
incident.query();
if(!incident.next()){ //If no Incident is Created in Last 30 Min
// Sending of Your Emails Here
}
 
please help me how to send email
 

Hi @Harsha Bharamb1 

You can set up an Event Registry and use eventQueue in your script to trigger notifications as needed.

eventQueue(String name, Object glideRecord, String parm1, String parm2, String queue)

Example:

 

gs.eventQueue("incident.commented", current, gs.getUserID(), gs.getUserName());

 

 

Alternatively, you can also consider using Flow Designer for a no-code approach with configuration alone.

 

Cheers,

Tai Vu

Harsha Bharamb1
Tera Contributor

I have tried with same registry but not working

PrashantLearnIT
Giga Sage

Hi @Harsha Bharamb1 

 

Can you please tell the use case scenario, who will receive this email, what is the purpose of creating incident that frequently?

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************