BRs Running even after setAbortAction is true in BR running before them
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 05:29 AM
Hello Friends - I have BR X which run on Order = 50 and do the below stuff but I found even though I get error pop up saying invalid insert it does not stop another BR Y which is on order 100,000 . Therefore the WS call is made and data is sent to External integration for an invalid ticket.
Kindly advise how can stop this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(gs.isInteractive())
{
gs.addErrorMessage('Please assign this Incident to SNOW Group before assigning to External Group');
current.setAbortAction(true);
}
})(current, previous);
- Labels:
-
Integrations
-
Upgrades and Patches

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 05:31 AM
Hi Bhupesh,
I need a little more detail on the business rules. The order is one factor... are they both BEFORE, AFTER, ASYNC? When do they run? Are they running on the same table?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 06:00 AM
Both running on Incident table and before insert
With Regards
Bhupesh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 05:56 AM
setAbortAction affects that BR only.
An error in one BR won't stop another from firing (unless there's some dependency between them). If you want dependent functionality, you may have to move the dependent code into one BR so an abort stops all processing for that BR.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 06:05 AM
That's now how I read it in the API docs... It says that it abort the next insert/update/delete action. If BR1 aborts, then BR2 shouldn't run at all.
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GlideRecord-setAbortAction_Boolean
In Bhupesh's case, the WS call should be in an AFTER (or ASYNC) BR because you want o trigger after the commit is done. Much like updating other records belong in an AFTER.
Async would be a better solution here if you don't need to make the user wait around for the webservice to return.