Close RITM Tickets without sending notification

deepika46
Tera Contributor

Hello everyone,

 

Is there any way to close the RITM requests without sending any notification. There is a requirement that we will receive a bulk of RITM's and those RITM in whichever state they are,(workflow might have many notifications) If we get the request to close the RITM tickets, No mail should be sent to requestor. Is it possible?

1 ACCEPTED SOLUTION

Hello @deepika46 ,

 

Please refer below code-

 

 

var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('numberINRITM01111,RITM01112,RITM01113,HRC01114');
gr.query();
while(gr.next()) {
var gr1 = new GlideRecord('sc_task');
gr1.addEncodedQuery('request_item='+gr.sys_id);
gr1.query();
while(gr1.next()){
gr1.setWorkflow(false);
gr1.state = '3'; // for closing
gr1.update();
}
var gr2 = new GlideRecord('sc_request');
gr2.addEncodedQuery('sys_id='+gr.request);
gr2.query();
if(gr2.next()){
gr2.setWorkflow(false);
gr2.state = '3'; // for closing
gr2.update();
}
gr.setWorkflow(false);
gr.state = '3';
gr.update();
} 

 

 

Please mark my answer as helpful and Please Accept Solution.
Thanks

View solution in original post

14 REPLIES 14

Hello Aman,

 

But that will close only the RITM right. What about the sc_task that will be attached to the RITM. If i get 1 RITM no like RITM12345. Then everything realted to the  RITM12345 needs to be closed i.e The request, the RITM and also the sc_task. Closing only the RITM will not close the sc_task or the Request. I need to close all of it. Is there any way of doing it

Hello @deepika46 ,

 

Use my above code then inside while loop Glide Req and close that then Glide Task and close that as well.

 

Please mark my answer as helpful and solution accepted.
Thanks

 

Hello @deepika46 ,

 

Please refer below code-

 

 

var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('numberINRITM01111,RITM01112,RITM01113,HRC01114');
gr.query();
while(gr.next()) {
var gr1 = new GlideRecord('sc_task');
gr1.addEncodedQuery('request_item='+gr.sys_id);
gr1.query();
while(gr1.next()){
gr1.setWorkflow(false);
gr1.state = '3'; // for closing
gr1.update();
}
var gr2 = new GlideRecord('sc_request');
gr2.addEncodedQuery('sys_id='+gr.request);
gr2.query();
if(gr2.next()){
gr2.setWorkflow(false);
gr2.state = '3'; // for closing
gr2.update();
}
gr.setWorkflow(false);
gr.state = '3';
gr.update();
} 

 

 

Please mark my answer as helpful and Please Accept Solution.
Thanks

Hello @Harsh_Deep ,

Thank you so much for the script. One qstn i had. If the RITM or the REQ or the SCTASK has any approvers, so when we close them, will the Approval state in the sysapproval table go to "No longer required" or do we have to do the same for approval table also like glide and all those

Hello @deepika46 

You need to do the same for approvals as well.

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Thanks