GlideAjax.getXMLWait is no longer supported

Srini19
Tera Contributor

Hi,

Getting below error after submit the catalog request through portal. Is there is any work around to resolve this?

Error:

There is a java script console error in your browser

GlideAjax.getXMLWait is no longer supported

Thanks

Srini

 

 

 

7 REPLIES 7

function onSubmit() {
// //Type appropriate comment here, and begin script below
// //Type appropriate comment here, and begin script below
var existingList = g_form.getValue('ritm_ex_user');
var compList = g_form.getValue('visitor_details');

alert("$$Existing List:: " + existingList);
alert(compList);

// var remUser = [];
// var newUser = [];


// //g_form.getValue("request_number");
// // alert("BJ Onchange");
// //Type appropriate comment here, and begin script below

var arrNew = [];
var fetchExistList = g_form.getValue('ritm_ex_user');
var newList = g_form.getValue('visitor_details');

//alert("Existing List ..." + fetchExistList);
//alert("New LIst::" + newList);
//var ritmId = this.getParameter('sysparm_ritm');

arrNew = newList.split(',');
var exList = [];
exList = fetchExistList.split(',');

var remUser = [];
var newUser = [];

var matches = "";
for (var i = 0; i < exList.length; i++) {
matches = "false";
for (var e = 0; e < arrNew.length; e++) {
// alert("In the for loop..." + exList[i] + "...." + arrNew[e]);
if (exList[i].trim() == arrNew[e].trim()) {
matches = "true";
//gs.addInfoMessage(exList[i] + ".rem.." + arrNew[e]);
// alert("Existing Matching Sys ID..." + exList[i] + '...' + arrNew[e]);
}
}
if (matches == "false") {
remUser.push(exList[i]);
// alert("$$ Remove User::" + exList[i]);
//gs.addInfoMessage("$$ Remove User::" + exList[i]);
}
}
//gs.addInfoMessage("$$ Remove User:::::" + remUser.toString());
//this._cancelDACUserTasks(ritmId, remUser.toString());

var matchesNew = "";
for (var j = 0; j < arrNew.length; j++) {
matchesNew = "false";
for (var k = 0; k < exList.length; k++) {
if (arrNew[j].trim() == exList[k].trim()) {
//gs.addInfoMessage('$$...' + arrNew[j] + '...' + exList[k]);
matchesNew = "true";
}
}
if (matchesNew == "false") {
newUser.push(arrNew[j]);
// alert("New User...." + arrNew[j]);
// gs.addInfoMessage("$$ New User.." + arrNew[j]);
}
}
//alert("Removed users list.... " + remUser.toString());
//alert("New users list...." + newUser.toString());
g_form.setValue('new_visitor_details', newUser.toString());
g_form.setValue('removed_vistor_details', remUser.toString());
alert("Removed User List::" +remUser.toString());

var ga = new GlideAjax('DacTaskUtils');
ga.addParam('sysparm_name', 'processDACTasks');
ga.addParam('sysparm_existList', fetchExistList);
ga.addParam('sysparm_newList', newList);
ga.addParam('sysparm_ritm', g_form.getValue("request_number"));

//ga.getXML(canTasks);
ga.getXMLWait(canTasks);


function canTasks(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
//alert("From Script Inc");
if (answer) {
alert("answer");
//g_form.setValue('ritm_ex_user', answer);
}
}

}

Hi,

if you are doing some validation using onSubmit then

remember these points:

1) Asynchronous GlideAjax won't work as by the time ajax function returns the value your form will get submitted

2) Synchronous GlideAjax is not allowed in portal and scoped application

Refer this link

How to limit the total quantity of a shopping cart for a specific service catalog item in New York v...

Refer these links for workaround/solution on how to use Synchronous GlideAjax in onSubmit

How To: Async GlideAjax in an onSubmit script

Asynchronous onSubmit Catalog/Client Scripts in ServiceNow

Regards
Ankur

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

@Srini

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread.

Regards
Ankur

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