Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Trigger email when no incident created in last 30 min

Harsha Bharamb1
Tera Contributor
 
5 REPLIES 5

Hello Prashant,

 

I have used below mentioned condition in scheduled job:

var incident = new GlideRecord('incident');
incident.addEncodedQuery('active=true^sys_created_onRELATIVEGT@minute@ago@30');
incident.query();
// If no incidents were created in the last 45 minutes, send an email
if (!incidentTable.hasNext()) {
gs.eventQueue("email.send",incidentTable,gs.getUserID(), gs.getUserName());
}