When REQ is submitted automatically RITM is closing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 01:15 AM
Hi,
When I have submitted REQ, RITM is creating, under RITM Tasks generated.
But when REQ is submitted automatically RITM is going to a closed complete state, But all the Tasks are in the open state only.
When Tasks are closed then only RITM and REQ should be closed.
Please help me
Thanks
Sriram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 01:28 AM
Hi Sriram,
check any business rule on sc_request is doing this.
Also is this happening for all catalog items or only for few
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 01:48 AM
Hi Ankur,
For catalog item I have created a workflow. I workflow around 5 tasks are there. After last Task I have kept set values activity. If I remove the activity it working correctly. But when all the Task are closed RITM and REQ should be closed. That is the reaso I kept there set values activity.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 01:50 AM
This is likely caused by the fact that the catalog tasks' closure is not triggering the workflow to continue running. What you'll need to do is create a business rule on the catalog task that triggers the RITM's workflow when the task is closed. That script will look something like this:
var ritmRec = new GlideRecord('sc_req_item');
if(ritmRec.get(current.request_item)) {
new Workflow().broadcastEventToCurrentsContexts(ritmRec, 'update', null);
}
this BR on the catalog task table should be an after BR as it is interacting with another table.
If it help mark helpful or correct
Thanks and regards
Anil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 01:36 AM
Hello Sriram,
You need to create a workflow or you can modify the previous one it will be achieved using this only be
use below given script in run script or in BR
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();
}}}
also, read these docs for more exposure
Hope this helps!
if my response helps you then kindly mark my answer helpful and correct otherwise if any query feels free to ask further.
Regards,
Ajim.