How to restrict the form to be submitted when the script condition matches and to retain oldValue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi All,
I am passing a validation when the below script condition matches through onchange Client script. But at the same time I need to restrict user from submitting the form with if the value of the justification field is less than 60.Also if user does any changes to a existing value and try to submit a newValue of less than 60 character, it should not take and the justification field should should retain it's oldValue . I have tried below scripts, onChange is working as expected but not sure how to restrict user from submitting the form with incorrect value without impacting existing value of the field(If form is getting submitted with value length <60).
Please suggest me on this what should be best approach to achieve this ? Please let know if you nee more info .
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
But we have already existing records which contain Build State Justification field value less than 60 characters so I don't want to impact those records . If I go with the above OnSubmit client script then if I update any field value other than Build State Justification field it also restrict to submit . That is the exact case I am facing .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Could you please let me know if that BR approach is correct or not ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes in that case use before update BR and disable onSubmit
if your field is getting populated with previous value then go ahead and test with multiple use-cases.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar Thanks for your confirmation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
