Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Business rule validation STAY ON FORM after blocked submission

leslie8
Mega Expert

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?

5 REPLIES 5

Thanks Julian as your response is helpful for me to stop submission and stay in same page using BR