Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2025 05:26 AM
Don't Know why its not working.
current.setAbortAction(true);
Want not closed incident if child incident is open.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2025 07:26 AM
Hello @arshadansar ,
Ok, got it, thanks. Please update your Business Rule script as follows:
(function executeRule(current, previous /*null when async*/ ) {
var childTask = new GlideRecord('incident');
childTask.addQuery('parent_incident', current.getUniqueValue());
childTask.addQuery('state', '!=', '7'); // not closed
childTask.query();
var arr = [];
while (childTask.next()) {
arr.push(childTask.getValue('number'));
}
if (arr.length > 0) {
gs.addErrorMessage('Cannot update the parent Incident until all child Incidents are closed: ' + arr.join(', '));
current.state = previous.state;
current.incident_state = previous.incident_state;
current.setAbortAction(true);
}
})(current, previous);
And make sure the BR "When" field is set to "before", not "after".
Regards,
Robert
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2025 08:01 AM
Thanks @Robert H. It's Working Now... 🙂
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2025 08:04 AM