- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017 04:48 AM
I have created a business rule on CMDB table to restrict the user from creating a duplicate CI with Insert and stay.
var ciname=current.name;
var gr=new GlideRecord('cmdb_ci');
gr.addQuery('name',ciname);
gr.query();
while(gr.next())
{
gs.addErrorMessage('Record already present');
current.setAbortAction(true);
}
Instead of current.setAbortAction(true);, I have tried return false. It was throwing the error 'Record already present' as expected, but the record was created.
Why return(false) didn't restrict the CI creation, or what is the basic difference between current.setAbortAction(true); and return false?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017 04:53 AM
Hi Sanker,
Return false does just that, - it returns false. It doesn't prevent additional business rules from running.
current.setAbortAction(true); stops the business rule and stops the system from continuing to run additional (higher order) business rules.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017 04:53 AM
Hi Sanker,
Return false does just that, - it returns false. It doesn't prevent additional business rules from running.
current.setAbortAction(true); stops the business rule and stops the system from continuing to run additional (higher order) business rules.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 05:26 AM
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2019 05:29 AM
Per https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideRecord-setAbortAction_Boolean , current.setAbortAction(true) does not stop subsequent business rules from executing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 06:59 AM
I have the same issue, currently I have all the following set, but the subsequent business rules still continue to process. I need to stop them.
current.setAbortAction(true);
current.setWorkflow(false);
return (false);
I also tried:
if (!current.setAbortAction(true)) {...}
in the next BR, but that didn't evaluate and the BR ran.