- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 02:44 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 06:24 AM - edited 10-19-2023 06:25 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 05:24 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 05:54 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 06:24 AM - edited 10-19-2023 06:25 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 08:28 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 09:20 AM
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