Error while submitting the Record Producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 01:48 AM
Hi,
While Submitting Record Producer form in Native UI I was getting the following error.
"The g_form.submit function has no meaning on a catlog item. Perhaps you mean g_form.addToCart() or g_form.orderNow() instead"
Please help me in fixing the issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:36 AM
Can you post your script's snapshot?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:44 AM
Hi,
Below Sample Code I used
function onSubmit() {
var actionName = g_form.getActionName();
var valide = new GlideAjax('XXXScriptInclude');
valide.addParam('sysparm_name', 'XXfunctionname');
valide.addParam('sysparm_sys_id', g_form.getValue('XXX'));
valide.getXML(function(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer == 'true') {
g_form.submit(actionName);
return true;
} else {
g_form.addErrorMessage('Error message');
return false;
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:14 AM
What are you trying to achieve?
what script are you using onSubmit?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:20 AM
Hi,
I am performing some validations in OnSubmit Catalog Client script using GlideAjax(getXML method), If the response is true then needs to submit the form else need to throw error message and stop form to submit.
If response is false-this scenario is working.
If response is true- getting the mentioned error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:44 AM
seems you are trying to submit the record producer via script
If the response is true then you can return true
Please share your script here
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader