The CreatorCon Call for Content is officially open! Get started here.

There is a JavaScript error in your browser console - Unhandled exception in GlideAjax

NG8
Giga Contributor

Getting the error on the Catalog side. This is the only Catalog script for that catalog item. 

 

function onChange(control, oldValue, newValue, isLoading) {
// if (isLoading || newValue == '') {
// return true;
// }
// var id_change=g_form.getReference('Submitted_For_Name',getUserID);
// function getUserID(id)
// {
// g_form.setValue('requested_for_user_id',id.user_name);
// }

var ga = new GlideAjax('user_details');
ga.addParam('sysparm_name','userFieldValues');
ga.addParam('sysparm_user',g_form.getValue('submitted_for_name'));
ga.getXML(simple);

function simple(response){
var answer = response.responseXML.documentElement.getAttribute('answer');
var a = answer.split(',');
g_form.setValue('submitted_for_user_id',a[2]);
return;

}
}

1 ACCEPTED SOLUTION

NG8
Giga Contributor

So seems like having "Applies on Requested Items" and "Applies on catalog Tasks" checked will give you this error. After i unchecked it, the error was gone. Really odd but it worked. 

Thank you all for your assistance with this. I appreciate it. 

I am marking this as correct answer for others to see. 

 

 

find_real_file.png

View solution in original post

24 REPLIES 24

Andrew Saxton -
Tera Expert

What does the error say?

Hi there, 

Error is "There is a JavaScript error in your browser console". Then when i look in browser console details, i see "Unhandled exception in GlideAjax."

Can you post a screenshot of user_details

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

NG8
Giga Contributor

Here it is: 

 

 

var user_details = Class.create();
user_details.prototype = Object.extendsObject(AbstractAjaxProcessor, {

userFieldValues : function(){

var arr = [];
var a = this.getParameter('sysparm_user');
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',a);
gr.query();

if(gr.next()){
arr.push(gr.email);//a[0]
arr.push(gr.phone);//a[1]
arr.push(gr.user_name);//a[2]
arr.push(gr.title.getDisplayValue());//a[3]
arr.push(gr.location.getDisplayValue());//a[4]
arr.push(gr.department.getDisplayValue());//a[5]
return arr.toString();
}
},

LoggedinUser :function(){

return gs.getUser().isMemberOf('Identity Management');
},

userName_fields : function(){

var arr = [];
var a = this.getParameter('sysparm_userid');
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name',a);
gr.query();
if(gr.next()){
arr.push(gr.sys_id);
arr.push(gr.email);
arr.push(gr.title);
arr.push(gr.department.getDisplayValue());
arr.push(gr.mobile_phone);
arr.push(gr.location);
}
return arr.toString();
},
type: 'user_details'
});