GlideAjax.getXMLWait is no longer supported
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 04:41 AM
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
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 05:38 AM
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);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 05:57 AM
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
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 07:20 AM
@Srini
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader