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.

Record producer is submitting even after giving error message

Aajay123
Tera Contributor

I have a on submit client script which is having AJAX call. when i try to submit the form with false condition the code is throwing error message, but the form is submitting even after throwing error message. Any help on this.

Note: I used "return false;" to stop the submission.

Kind regards,

Ajay.

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

GlideAjax Async doesnt work well on Onsubmit scripts. 

So change that to a synchronous call or onchange script. Or maybe a Before insert BR whatever works best for you.

-Anurag

I tried it by Using Before insert BR. I have a doubt, at when to run condition do I need to select "sc_cart_item" or

"sc_cat_item_producer" table.

before BR will be on RITM (sc_req_item) and restrict creation of ritm.

what are you trying to check on submit?

-Anurag

I already tried with "sc_req_item", but it's not working. This script needs to work on Record producer.
I am using on submit script to show error message and stop the submission when condition doesn't meet.