We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Notify if an incident is high priority and unassigned for 2 hour when it is not assigned to any grou

ServiceNow Use6
Tera Guru

Hi,

I tried, but the email is not triggering. I am using after business rule with insert update

 
(function executeRule(current, previous /*null when async*/) {

    // Notify if an incident is high priority and unassigned for 2 hour when it is not assigned to any group
   
        var gr = new GlideRecord('incident');
        gr.addEncodedQuery('sys_created_onBETWEENjavascript:gs.beginningOfLast2Hours()@javascript:gs.endOfCurrentMinute()^assignment_groupISEMPTY^priority=1');
        gr.query();
        while(gr.next()){

        gs.email('aileen.mottern@example.com', '', 'Aileen, assignment group is unassigned and the priority is 1', 'Aileen, assignment group is unassigned and the priority is 1');
    }
   

 

Regards

Suman P.

 

})(current, previous);
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@ServiceNow Use6 

business rule requires a database operation to trigger.

better to use Flow for this, something like this and enhance further

incident unassigned email.gif

OR

You can use inactivity monitor -> no scripting required

How Inactivity Monitor works? 

Get active with inactivity monitors 

Set an inactivity monitor 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Hi @ServiceNow Use6 

BR will not work, mate, as there is no database action trigger. Use a Flow or Scheduled Job instead.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG

****************************************************************************************************************