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:46 AM
Hi,
The following script I am using
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:52 AM
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); // the error should be on this line. Comment this line and try
return true;
} else {
g_form.addErrorMessage('Error message');
return false;
}
});
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:55 AM
Hi,
Commented and tried, I am not getting error but form is also not submitting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:56 AM
try this script once
function onSubmit() {
if (!g_form.ajaxComplete) {
ajaxCall();
return false;
}
function ajaxCall(){
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.ajaxComplete = true;
g_form.submit();
} else {
g_form.addErrorMessage('Error message');
return false;
}
});
}
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 03:02 AM
Hi,
Still getting same error message.