Business Rule does not abort State advancement
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have a BR to require an attachment, however it is not preventing the State from progressing.
(function executeRule(current, previous) {
// Only enforce when moving to Screening
if (current.state == '3' && previous.state != '3') {
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', current.sys_id);
att.addQuery('table_name', 'dmn_demand');
att.setLimit(1);
att.query();
if (!att.hasNext()) {
gs.addErrorMessage('At least one attachment is required before moving to Screening.');
current.setAbortAction(true);
}
}
})(current, previous);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
The Filter Conditions covers when you want the script to run, so you don't need this script wrapped in an if statement that might not ever be true(is the value the number 3 or the string '3'???)
