Close bulk ritms using background script without triggering notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 06:06 AM
Hi Team,
I want to close almost 300 STASKS and RITMS using background script. But i do not want to trigger closure notification to the requester. I have the below background script. Even though workflow is set to false, it does automatically close the RITM when stask is closed and also triggers notification to requester. Your help will be much appreciated.
var gr = new GlideRecord('sc_task');
var string='parent.number=RITM3580262'; //Replace your Query here
gr.addEncodedQuery(string);
gr.query();
while(gr.next())
{
gr.setWorkflow(false); //this will not allow any Notifications to get trigger
gr.autoSysFields(false);
gr.setValue('active', 'false');
gr.setValue('state', '3');
gr.setValue('u_closure_code', 'Skipped');
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 06:38 AM
Hi @Nafeesa bashir ,
Is that Notification triggered by a Event using Business Rule? If you are not using Business rule to trigger Notification, setWorkflow(false) won't work.
Go to the Notifications Table (sysevent_email_action), deactivate the email which is triggered while closing the records and run the script again, then reactive the Notification.
-Dhanraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 07:12 AM
Hi @Nafeesa bashir, You can refer to https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0858407
Regards,
Sunil