How do I prevent Record Producer redirect following onSubmit validation failure

Euan Caldwell
Tera Contributor

I've created a Record Producer for creating a Demand Record which has start/end date fields. I want to ensure that the end date is after the start date.

So I created an onSubmit client script which checks the dates and generates and alert and returns false appropriately. The script works correctly and no record is created if the dates are incorrect. However, it still attempts to redirect to a non existent record.

Any ideas how I stop this from happening?

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

if you are using return false in onSubmit client script then it would halt the record producer submission

Can you share your script?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Euan Caldwell
Tera Contributor

Hi Ankur,

I solved this, but couldn't figure out how to withdraw the question.

While I though my onSubmit script was working (as it didn't create a demand record) it was actually failing part way through so never returned a true or false. However, the redirect was still moving to the other screen and obscuring the javascript error message.

Once I'd sorted that issue everything worked as expected.

Thanks.

Euan.