Is there a way to close tickets without sending notifications?

Navaneeth1
Tera Guru

I'd like to close 200 tickets but without sending any notifications. I can't disable the notifications for this process due to some conflicts. 

Is there a way to write a script or any other way to update all these records without triggering the notification condition which gets triggered when the state becomes closed?

Thank you!

1 ACCEPTED SOLUTION

Sohail Khilji
Kilo Patron
Kilo Patron

HI @Navaneeth1 ,

 

Here is your fix script :

 

 

var gr = new GlideRecord('incident');
gr.addEncodedQuery('numberINC0001111,'INC004543'); //pass the query for your 200 inc
gr.query();
while(gr.next()) {
gr.setWorkflow(false);   // prevent notifications from going out
gr.state = '3'; // for closing , Set as per your system config
gr.update();
}

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

NO mate, if condition match email will trigger. 

*************************************************************************************************************
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]

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

Sohail Khilji
Kilo Patron
Kilo Patron

HI @Navaneeth1 ,

 

Here is your fix script :

 

 

var gr = new GlideRecord('incident');
gr.addEncodedQuery('numberINC0001111,'INC004543'); //pass the query for your 200 inc
gr.query();
while(gr.next()) {
gr.setWorkflow(false);   // prevent notifications from going out
gr.state = '3'; // for closing , Set as per your system config
gr.update();
}

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

@Sohail Khilji ,

Thank you so much! Could you please let me know if 

gr.setWorkflow(false);

needs to mention my notification action somewhere or will this just not allow any workflow, business rule or notification to run?

No, not required to mention anything, just go with the script as given. 

 

Kindly make the answer as accept and helpful to clear the queue...


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect