- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 03:24 AM
Hi,
I am currently working on Request, RITM and Catalog Task.
I have got a requirement to close the parent RITM when all the child Catalog Tasks are complete and also need to close the parent Request record when all the child RITM's are complete.
Could someone please let me know what needs to be done here. I know I need to script a BR here but not sure what to put in there.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 05:12 AM
Hi,
Try below code:
// If you have more than one RITM for REQ then Use this Code.
var getRITM = new GlideRecord('sc_req_item');
getRITM.addActiveQuery();
getRITM.addQuery('request',current.request);
getRITM.query();
if(getRITM.next())
{
//DO whatever you want to do here;
//Dont close REQ as One of the RITM Is open.
gs.addInfoMessage('REQ cant be closed because one of the RITM is Open');
}
else
{
var req = new GlideRecord('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if(req.next())
{
req.req_state = 'closed_complete';
req.update();
}
}
Thank you,
Ashutosh Munot
Please Mark Correct, Helpful or Like.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 05:29 AM
When are you triggering this Business rule.
See first table in business rule. There you need to give condition when to run this business rule.
It should be after State changes to CLosed complete or something like this.
Thank you,,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 05:35 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 05:41 AM
Hi,
Can just put some info messages in code and check it got triggered. And also check choice value of Close Complete in REQUEST STATE.
Thank you,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 05:46 AM
Hi Ashutosh,
The choice value of Closed Complete is 3. And, I don't know how to check whether it is triggered or not. If you don't mind, I will provide my instance details so that u can go and check what's going wrong. If that's Ok, please send me a test email at prudhvir36@gmail.com.
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2017 06:03 AM
Hi,
I did. Where is this business rule.
Thank you,
Ashutosh Munot