Prevent auto closing the RITM when any one of SC tasks are open
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
We have a flow created for all the catalog items. The Sc task should auto create, and if SC task will close the RITM also auto closes, and it will update accordingly. Now the client wants another requirement like for one RITM one SC task is generating, and here the user created second SC task manually and it is linked to same RITM. If we close the auto generated SC task, the RITM is closing even though the manually created is still open. We can't the flow in the floe designer as we have 100's of catalog items, each having a separate flow. How we can overcome this. i have used BR, it is not applying for manually created SC task. When I use the BR, if I close the auto generated SC task, the RITM is auto closing, it is not caring about the manually created SC task. Please help me with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @suryaogeti1
Create a Before Insert/Update BR for it.
Try this:
- Name: Prevent RITM Closure if SCTASK is Open
- Table: Catalog Task (sc_task)
- When: before
- Insert/Update: Check both Insert and Update
- Advanced: Check
Conditions
- State [is one of] Closed Complete, Closed Incomplete, Closed Skipped
(function executeRule(current, previous /*null when async*/) {
var grTask = new GlideRecord('sc_task');
grTask.addActiveQuery();
grTask.addQuery('request_item', current.request_item);
grTask.addQuery('sys_id', '!=', current.sys_id); // Exclude the current task being closed
grTask.query();
if (grTask.hasNext()) {
gs.addErrorMessage('You cannot close this Request Item while there are still open Catalog Tasks.');
current.setAbortAction(true);
}
})(current, previous);
Also you can check this: Restrict RITM Closure when SCTASK is Open using Business Rules
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The existing flow is over riding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
why you can't use before update BR on sc_task which stops the closure?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader