How to prevent users from closing an Incident if there are active Child Tasks?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
how to prevent it using flow????
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @MOHAMEDYASA,
there are plenty of options, but a business rule might be the best one.
You can get inspiration from this post
No AI was used in the writing of this post. Pure #GlideFather only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
flow will run in backend and not UI side.
You need to add before update business rule so that whenever user tries to close INC it checks Active tasks
Something like this
Before Update: Condition -> State [Change to] Closed
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("incident_task");
gr.addQuery("parent", current.sys_id).addOrCondition("incident", current.sys_id);
gr.addActiveQuery();
gr.setLimit(1);
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage('You cannot close INC as there is active open incident task');
current.setAbortAction(true);
}
})(current, previous);
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello @MOHAMEDYASA ,
No, it is not possible, as Flows are not connected to the UI of the user and his transactions. Therefore, a flow Cannot abort a user transaction.
Use Business Rules if you want to do achieve the same.
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago
Hi @MOHAMEDYASA ,
The best way to manage this use case at server level and write BR [ update] on incident table and check if there is any other active INC exist with the current INC added as parent, if record found then abort the SAVE action else SAVE it. Refer the code shared by Ankur Bawiskar.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
