Error while submitting the Record Producer

Prathyusha G
Tera Contributor

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

15 REPLIES 15

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;
}

});

}

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;
}

});

}

Regards
Harish

Hi,

Commented and tried, I am not getting error but form is also not submitting

@Prathyusha G 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

 

Still getting same error message.