OnSubmit Client Script not working in ServicePortal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 08:20 AM
Hello Experts,
I want to understand how could we use the below script in catalog client script.
1 function onSubmit() {
2 if (g_scratchpad.isFormValid)
3 return true;
4 var actionName = g_form.getActionName();
5 doAsyncTask(function() {
6 g_scratchpad.isFormValid = true;
7 g_form.submit(actionName);
8 });
9 return false;
10 }
when I am using I got this error
onSubmit script error: ReferenceError: g_scratchpad is not defined:
function () { [native code] }
I am referring to this article - https://hi.service-now.com/kb_view.do?sysparm_article=KB0779964 where the above solution mentioned.
how g_scratchpad.isFormValid is configured on catalog form?
Your comments would be apricated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 09:30 AM
Can you share prints screen of the onsubmit script configuration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 09:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 02:44 AM
Hello Willem,
I looked into your article very nice explanation. but I have a question, How did you configured g_scratchpad.isFormValid in catalog client script. please explain this.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 02:59 AM
It is available for Catalog Client script of UI Type service portal/mobile OOTB. You do not have to set up anything additional.