setAbortAction not working with GlideAjax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 07:03 PM
We had put in two business rules to limit the actions of Demands so that the business properly completes them before closing the Demand. Specifically, the Demand needs to be properly Approved before it is Completed. And close notes are required when completing a Demand.
However, when we attempt to create a project from a Demand, we are noticing that the Demand is automatically set to complete. Naturally we thought the business rules would prevent creation of the project only to discover that is not the case:
It would appear that the "Create Project" link uses a GlideAjax to not only create the project, but to set the Demand to Complete. The question is whether setAbortAction (true) does not cover situations when a GlideAjax is initiated.
Advice on how to prevent the project entry from being created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 07:21 PM
you should validate it before making the GlideAjax call itself.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 07:24 PM
I have highlighted the part where you will have to perform the validation and stop user
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 08:21 PM
Hi @tahnalos ,
The issue you're encountering arises because the setAbortAction(true) method in a business rule prevents direct user-initiated actions, such as form submissions, but it does not inherently block backend updates triggered by a GlideAjax script. When creating a project from a Demand, the Create Project link likely uses a GlideAjax script to set the Demand's state to "Complete," bypassing the usual checks. To enforce proper validation, you need to add backend checks to ensure the rules are respected regardless of how the update is initiated.
You can create a Before Update Business Rule on the demand table to prevent the state from being set to "Complete" unless the Demand has been approved and close notes are provided. This approach will apply universally, covering updates triggered by both interactive and backend operations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 09:22 PM
The Before Update Business rule is what I had done and is what contains the error message and the setAbortAction. However, the Create Project link is a UI action and is what is triggering the GlideAjax. What you're saying makes sense if one thinks that the setAbortAction does not cover the GlideAjax scope.
Ankur's suggestion to validate before the GlideAjax call may be what I need to do, in other words, the UI action itself may need to be modified to validate before the meat of the UI action code is executed. I need to talk to the business as to how we may accomplish this.
Thanks