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

Can you post your script's snapshot?

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

});

}

Ankur Bawiskar
Tera Patron
Tera Patron

@Prathyusha G 

What are you trying to achieve?

what script are you using onSubmit?

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

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.

 

 

@Prathyusha G 

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

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