Close RITM and Request on close of Catalog Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 03:56 AM
Hi Team,
I have one requirement that when the Catalog Task is closed then automatically the RITM as well as Request will get Closed.
If the state of Task changes to Closed Complete then for RITM as well as Request will also change the state to closed complete.
Thanks & Regards,
SNOW@Das

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 04:40 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 05:57 AM
Hi,
sample script here. You can modify it as per your req.
Script:table "sc_task" and trigger the BR only for the condition state is closed incomplete.
closeItemIfRequired();
function closeItemIfRequired(){
// check to see if any of our peers are currently *not* closed
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.request_item);
gr.addQuery('active', true);
gr.query();
if (!gr.next()) {
// no peer task is currently open
var sc_req_item = new GlideRecord('sc_request_item');
sc_req_item.addQuery('sys_id', current.request_item);
sc_req_item.query();
if(sc_req_item.next())
{
//update the field of sc_req_item
sc_req_item.update();
}}}
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 06:58 AM
You can use BR or schedule job or Fix Script for this .
For BR:-
Create BR on catalog task table which is sc_task and query for parent record from there only , if your task is set to close then close it's parent record .
For Schedule Job:-
If you are looking for something like your all tickets should be closed after some days of inactivity then you can use this method , logic will remain same for this one .
For Fix Script :-
If there are many closed incomplete tasks present in your instance and you want to close them all in a single shot , then you can opt fix script
Go to System Definition and search for Fix Script . Put your logic there , save it and select run option and then select proceed in background option .
Fix script is better and suggested way instead of Background Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 08:59 AM
Hi Gagan,
Can you please let me know in brief. As to what will be the conditions and script set for Business Rule.
And for rest of the techniques as well. So it will be helpful for me going forward.
Thanks,
SNOW@Das