How do I prevent Record Producer redirect following onSubmit validation failure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 02:51 AM
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?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2020 02:11 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 02:15 AM
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.