The CreatorCon Call for Content is officially open! Get started here.

Script to Close Incident Request, Requested Item and Catalog Task without sending the Notifications?

VIKASM535239375
Kilo Sage

Script for Bulk Closure of Incident Request, Requested Item and Catalog Task without sending the Closure or any other  Notifications using script?

 

Please let me know the steps

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @VIKASM535239375 

 

https://www.servicenow.com/community/developer-forum/close-multiple-incidents-without-sending-email-...

 

Before closing an incident, make sure all mandatory fields are included in the script if needed. Also, when closing a REQ, ensure that the SCTask is closed first via script. It’s better to run three separate scripts:

  1. One for Incident
  2. One for SCTask
  3. One for RITM/REQ
*************************************************************************************************************
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]

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

View solution in original post

4 REPLIES 4

MAYANK9
Tera Expert

I believe there is only one way. In the same script, you can glide the respective notification records and mark them inactive as the closure function script starts. Once the closure function ends, you can make the notifications active again. Or you can use function to mark other workflows as false before your closure function ends.

Najmuddin Mohd
Mega Sage

Hello @VIKASM535239375 ,
You can setworkflow(false); before gr.update(); in the script.

If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @VIKASM535239375 

 

https://www.servicenow.com/community/developer-forum/close-multiple-incidents-without-sending-email-...

 

Before closing an incident, make sure all mandatory fields are included in the script if needed. Also, when closing a REQ, ensure that the SCTask is closed first via script. It’s better to run three separate scripts:

  1. One for Incident
  2. One for SCTask
  3. One for RITM/REQ
*************************************************************************************************************
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]

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

Below Script should work:-

 

var gr = new GlideRecord('incident');  
gr.setLimit(100); //will update 100 records at a time
gr.addQuery('active', 'true');  
gr.query();  
while(gr.next())  
  {  
  gr.short_description = 'test';  
  gr.setWorkflow(false); //Will not fire BR/email notifications  
  gr.update();  
  }