- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2022 06:36 AM
Hi,
How to close ritm from backend.
How to close with background script.
Regards,
Nivedita
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2022 06:46 AM
Hi,
Try this code
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.addQuery('number','RITM000123');
ritmRec.query();
while(ritmRec.next()){
ritmRec.state= 3; //check closed state value
//ritmRec.setWorkflow(false); write this line if you dont want any other business rules or scripts to run
ritmRec.update();
Mark as correct and helpful if it works.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2022 06:46 AM
Hi,
Try this code
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.addQuery('number','RITM000123');
ritmRec.query();
while(ritmRec.next()){
ritmRec.state= 3; //check closed state value
//ritmRec.setWorkflow(false); write this line if you dont want any other business rules or scripts to run
ritmRec.update();
Mark as correct and helpful if it works.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2022 06:52 AM
There is an OOB Business Rule that handles the closing of the records. Is there a specific issue that prevented the RITM from closing?
As long as the SCTASK's generated from the RITM are completed, and the workflow correctly set the closing values, the RITM Stage should have gone to Completed and Active to false.