What is the correct way to use current.setAbortAction(true)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2018 08:34 AM
I have a business rule in which I'm attempting to use current.setActionAbort(true), but it doesn't seem to be working as I would expect. The BR runs onBefore Update to check and see if the current record has any open subtasks. If there are open subtasks, it should stop the update of the record, and display an info message at the top of the screen. In it's current form, it does stop the record from being updated, however it reloads the page with the same field changes still displayed, and it does not show the Info message at the top of the record. I'm wondering if I'm using the 'current.setAbortAction(true)' incorrectly, or if I'm not understanding how it works in general. Any help is appreciated! Code is below:
(function executeRule(current, previous /*null when async*/) {
var tsk = new GlideRecord('task');
tsk.addQuery('u_parent_task',current.sys_id);
tsk.addQuery('active',true);
tsk.query();
if(tsk.getRowCount() > 0) {
gs.addInfoMessage('Please close all subtasks to close the request');
current.setAbortAction(true);
}
})(current, previous);
- Labels:
-
Scripting and Coding