- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 09:41 AM
Hey all, my business rule seems to be running twice and im quite stuck on it and not sure whats going on.
this business rule is triggered on update, and noticed on the debugger that it seems to go through the function twice.
here is my code:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var targetTable = new GlideRecord('incident_task');
var shortDes = current.short_description;
targetTable.addQuery('parent', current.sys_id);
targetTable.addQuery('active', true);
targetTable.query();
if (targetTable.getRowCount() > 1) {
gs.addInfoMessage('Incident cannot be resolved because all incident tasks are not closed');
current.setAbortAction(true);
} else {
gs.addInfoMessage('No tasks available!');
}
})(current, previous);
here is when it runs:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 09:55 AM
For the filter condition, change it to
State changes to Resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 09:55 AM
For the filter condition, change it to
State changes to Resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 10:02 AM
Hello,
Yes as Mike suggested please try the condition to State changes to Resolved.
Because currently your state BR will run anytime if it updated and state is resolved.
Thanks.