- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 06:37 AM
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;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 10:53 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 12:17 PM
Can you please put return out of the if(){} in SI
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();
},
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 06:30 AM
We have several other catalog scripts using "using_details" with no issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 07:00 AM
See what you are getting for answer in the console.
function simple(response){
var answer = response.responseXML.documentElement.getAttribute('answer');
var a = answer.split(',');
console.log('got a = ' + a.toString());
g_form.setValue('submitted_for_user_id',a[2]);
//return;
}
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 09:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 09:16 AM
Before the getXML call can you add
alert('sending user = ' + g_form.getValue('submitted_for_name'));
Vinod Kumar Kachineni
Community Rising Star 2022