Close bulk ritms using background script without triggering notification

Nafeesa bashir
Tera Contributor

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();

}

2 REPLIES 2

dhanrajb
Tera Guru

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.

SunilKumar_P
Giga Sage