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 08:30 AM
Hi,
Please find my article on this topic:
Mark helpful and bookmark if you like it.
The error, you get it in the back-end? There it will not work. You need to create a Display business rule that sets the g_scratchpad value:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 06:04 AM
I have a similar situation where I am getting the following error when someone tries to use the form on the backend of ServiceNow:
onSubmit script error: ReferenceError: g_scratchpad is not defined:
function () { [native code] }
It works fine within Service Portal. The link above no longer works where you mentioned creating a Display business rule that sets the g_scratchpad value. Any help would be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 08:44 AM
Where are you running this script? Is this an onSubmit Catalog client script attached to a catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 09:23 AM