- 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 04:04 AM
Thabk you and 1 more info i needed. This is the script i have written
var rit=new GlideRecord('sc_req_item');
rit.addEncodedQuery();// all the ritm lists i will be getting
rit.query();
while(rit.next())
{
rit.state=5;// closed state
rit.setWorkflow('false');
rit.update();
}
When i close the RITM, will the Request also will be closed and what about if there are any sc_tasks that are there. Will all be closed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 04:17 AM
Hi @deepika46 ,
Usually the flow is like 1st that Task --> RITM --> REQ. If u close all the task RITM will get closed which in turn will close the REQ.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 04:21 AM
Hello @deepika46
It will not close REQ and SCTASK because you are using setWorkflow(false)
If you want that as well, We have to write another logic for that.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 03:27 AM
Hello @deepika46
Please use this code for your query-
var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('numberINRITM01111,RITM01112,RITM01113,HRC01114');
gr.query();
while(gr.next()) {
gr.setWorkflow(false);
gr.state = '3';
gr.update();
}
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 04:38 AM
Hi @deepika46
You can either create a fix script which will require you to write the js code and run it.
OR
My preferred way is to create a data source and trnasform map for requested item, and mark "run business rule checkbox" as false, and then just by data upload you can mark the RITM as closed without hassle of coding and this solution can be used in the future and comes in handy.
Aman Kumar