Business rule validation STAY ON FORM after blocked submission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2015 10:45 AM
I am using a Business Rule for server side validation.
If there is an error in the user entry, I want to have the Business Rule stop the form submission AND STAY ON THE FORM after they press the submit button so that they can have a chance to correct the error and re-submit the form.
Right now the business rule is running and it stops data from being entered into the database BUT it goes to a blank page after form submission. I want to STAY ON THE SAME FORM that they were working on with their entries retained.
The line action.setReturnURL(current); does not work.
Business Rule
loanerDates();
function loanerDates() {
gs.addInfoMessage('Record submission aborted.'); // error message
current.setAbortAction(true); // stop the form submission
action.setReturnURL(current);
}
Any suggestions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2015 10:52 AM
Hi Leslie,
I think you can write a client script on change and then do the validation which will be solve the issue.
Please let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2015 10:56 AM
HI Pradeep thank you for the suggestion. However, I have client scripts already.
I want to use a Business Rule since that is a server-side script and will run even if client scripts are disabled. The reason for using a BR in addition to client script is listed in my previous post https://community.servicenow.com/thread/182751
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2015 11:22 AM
This might be a bug that I am running into. I cant redirect while also stopping the form submission in the business rule. Ugh! Does anyone have any ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 12:30 AM
The correct script would be:
action.setRedirectURL(current);
The return URL specifies where the user is redirected if he uses back on the next page.
See also:
Difference between setRedirectURL() and setReturnURL()