Javascript error in your browser console : Unhandled exception in GlideAjax in Service Portal

app
Mega Expert

Hello All,

I have written a catalog client script and script include nut getting an error message.

There is a JavaScript error in your browser console

Unhandled exception in GlideAjax in Service Portal

Please let me know how can I solve this.

Client script :

function onSubmit () {

var actionname = g_form.getActionName();
var scratchpad = typeof g_scratchpad == 'undefined' ? NOW : g_scratchpad;

if (scratchpad.isSupportGroup) {
return true;
}

var val = g_form.getValue('datacity_service');

var ga = new GlideAjax('DataCityRequest');

ga.addParam('sysparm_name', 'populateApplicationFields');
ga.getXMLAnswer(populateApplicationFields);

return false;

function populateApplicationFields(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
var obj = answer.evalJSON(true);

var PV_Corporate_Request = obj.property1.split(",");
var PV_Customer_Request = obj.property2.split(",");
var PV_Operations_Request = obj.property3.split(",");

var AppropriateCategory = g_form.getValue('appropriate_category');

if ((AppropriateCategory == 'Request Enhancement') || (AppropriateCategory == 'SME-Project Estimates') || (AppropriateCategory == 'Report Defect')) {

if (PV_Corporate_Request.indexOf(val) > -1) {
g_form.setValue('support_group', 'DWBI-Corporate-Requests');
scratchpad.isSupportGroup = true;
}
else if (PV_Customer_Request.indexOf(val) > -1) {
g_form.setValue('support_group', 'DWBI-Customer-Requests');
scratchpad.isSupportGroup = true;
}
else if (PV_Operations_Request.indexOf(val) > -1) {
g_form.setValue('support_group', 'DWBI-Operations-Requests');
scratchpad.isSupportGroup = true;
}
else {
g_form.setValue('support_group', 'ITDS-BI-REQUESTS');
scratchpad.isSupportGroup = true;
}

scratchpad.isSupportGroup = true;
g_form.orderNow(actionname);
}
else {
g_form.setValue('support_group', 'ITDS-BI-REQUESTS');
scratchpad.isSupportGroup = true;
g_form.orderNow(actionname);
}

}

}

 

script include:

var DataCityRequest = Class.create();
DataCityRequest.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
populateApplicationFields: function() {
var obj = {};
obj.property1 = gs.getProperty("Datacity Request - DWBI-Corporate-Requests");
obj.property2 = gs.getProperty("Datacity Request - DWBI-Customer-Requests");
obj.property3 = gs.getProperty("Datacity Request - DWBI-Operations-Requests");

return JSON.stringify(obj);
},
type: 'DataCityRequest'
});

 

Thanks

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

Yeah, me silly, the reference to the function(s) need to be "bound" as below:

	var submitMethod = typeof g_form.orderNow == 'function' ? g_form.orderNow.bind(g_form) : g_form.submit.bind(g_form);

View solution in original post

19 REPLIES 19

Hello Chris,

find_real_file.png

that's... not your console. that's your inspector or your code from servicenow.

find_real_file.png

if you drop the ">" arrow down you should see the actual exception.

_ChrisHelming
Tera Guru

that's... not your console. that's your inspector or your code from servicenow.