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.

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);
5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ServiceNow Use6 

 

It’s better to use the Flow Designer for this, where you can easily perform lookups and send emails to a person or group. As a best practice, all incidents from P1 to P4 must first be assigned to SD to take action

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

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

Ankur Bawiskar
Tera Patron
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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

ServiceNow Use6
Tera Guru

Hi @Dr Atul G- LNG @Ankur Bawiskar,

I can use flow designer but i want to use business rule.

Regards

Suman P.

@ServiceNow Use6 

you can do this even without scripting using Inactivity monitor or Flow designer.

Any reason you want to do using business rule only?

Many customers are moving towards no-code, low-code approach.

💡 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader