- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 11:46 AM
Incident should not get resolved until all incident tasks associated with it gets closed.
How to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 08:54 PM
Hi,
you can use Before update BR on incident table
Condition: State [Changes to] Resolved
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = current.getUniqueValue();
var gr = new GlideRecord("incident_task");
gr.addActiveQuery();
gr.addQuery("incident", inc).addOrCondition("parent", inc);
gr.setLimit(1);
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage("Please close incident task before resolving incident");
current.setAbortAction(true);
}
})(current, previous);
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-24-2022 09:29 PM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
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
‎01-17-2025 02:36 AM
Hi Ankur,
Thank you for code and it is working good for me. However I am facing 1 issue here that error message getting displayed on screen is only for few second and it is getting disappeared (I want it to be displayed). Do you have any clue why it is happening. I checked similar BR, tried with condition change, looked into UI policy and I could not suspect anything.
Can you please help here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2025 02:58 AM
the error message will disappear after sometime based on system property, it won't stay for long
that's platform behavior.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader