Ritm should close once all sctasks are closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 07:34 AM
Hi Community,
Here for single RITM, we do have many SCTASKs. So, RITM should get closed only once all tasks are closed. We are doing this in client domain in flow designer. But it's not working. Can anyone please help on this.
BUSINESS RULE :
Regards,
Tulasi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 09:21 AM
Hello @tulasi8
Please refer to the steps below:
- Configuration setup for business rule
- Script
(function executeRule(current, previous /*null when async*/ ) {
var ritmGR = current.request_item.getRefRecord();
var gr_task = new GlideRecord('sc_task');
gr_task.addQuery('request_item', ritmGR.sys_id);
gr_task.addQuery('active', 'true');
gr_task.addEncodedQuery("stateNOT IN3,4,7"); //closed complete, incomplete and skipped
gr_task.query();
if (!gr_task.hasNext()) {
ritmGR.state = 3; // Closed Complete.
ritmGR.update();
}
})(current, previous);
This Business Rule ensures that the associated Requested Item (RITM) is automatically closed once all active tasks are completed.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar