How to use GlideAjax in on submit client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 05:37 AM
Hi Team,
I have to do a validation on one variable called tax id ,if the tax id does not exists in account table ,it clear out the value, and is happening with On change client script.But it should not allow to submit the form.But form submission is possible.How can we validate that field on oN Submit.
Thanks,
Karan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 12:24 AM
that should not be ideally the case.
if the validation fails you are clearing the value and making it mandatory; then how user can submit form with empty mandatory field?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 12:31 AM
Hi @Ankur Bawiskar ,
I guesss the issue is it is not waiting till we get response from the server side.
Thanks,
Karan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 12:34 AM
@KARAN24 , not sure if you go the chance to look into the response shared at the top, the same thing I have already mentioned
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 12:44 AM
Refer these links for workaround/solution on how to use Synchronous GlideAjax in onSubmit
How To: Async GlideAjax in an onSubmit script
Asynchronous onSubmit Catalog/Client Scripts in ServiceNow
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader