- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 04:46 AM - edited 06-13-2025 04:49 AM
Hi,
If related child 'Incident_task' is Active, prevent the Incident Resolved/Closed.
tried with Before BR and Script Include and OnSubmit CS also, but not working as expected- suggest
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2025 07:30 AM
Hi @Kusuma Sai ,
Try to use Before Update BR only.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident_task');
gr.addQuery('active','true');
gr.addQuery('incident',current.sys_id);
gr.query();
if (gr.next()) {
gs.addInfoMessage('This Incident cannot be resolved as there is or are active child Incident Tasks. Please close them first');
current.incident_state = previous.incident_state;
current.state = previous.state;
current.setAbortAction(true);
gs.setRedirect(current);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 04:49 AM
are you querying with correct field? incident or parent at line 5
what debugging did you do?
Only before update business rule is sufficient, why to have script include and onSubmit?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 04:52 AM
'incident' only sir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 05:20 AM
what debugging did you do?
did you add gs.info() in your BR and see if it ran?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 05:29 AM - edited 06-13-2025 05:34 AM
@Ankur Bawiskartried sir, but not helping anything
what i have to added here sir? Incident Task > Incident or Incident Task Parent ?