- 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-12-2019 11:02 AM
Glad you got it resolved and Good luck
But you can atleast mark other comments as helpful. People invested time and effort in assisting you in this question.
Cheers
Prateek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 07:32 PM
Is the catalog item view is the part in the request item view > variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 02:02 PM
Hi NG,
I noticed in your Client Script that you have called the field "Submitted_For_Name" and "submitted_for_name" in two different casings with your g_form methods. Please verify that you are using the same casing as the server name for the field/variable, as this does matter.
I'm referencing specifically:
var id_change=g_form.getReference('Submitted_For_Name',getUserID);
and
ga.addParam('sysparm_user',g_form.getValue('submitted_for_name'));
If my answer helped you, or is correct, please mark it as 'Helpful' or 'Correct'
Thanks,
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 06:51 AM
I have updated it to all be "submitted_for_name" and still getting the same error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 02:39 PM
Can we try this??
SI:
var user_details = Class.create();
user_details.prototype = Object.extendsObject(AbstractAjaxProcessor, {
userFieldValues : function(){
var retVal ;
var arr = [];
var a = this.getParameter('sysparm_user');
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',a);
gr.query();
if(gr.next()){
retVal = gr.email+','gr.phone+','+gr.user_name+','+ gr.title.getDisplayValue() +','+gr.location.getDisplayValue()+','+ gr.department.getDisplayValue();
}
return retVal;
},
LoggedinUser :function(){
return gs.getUser().isMemberOf('Identity Management');
},
userName_fields : function(){
var retVal;
var a = this.getParameter('sysparm_userid');
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name',a);
gr.query();
if(gr.next()){
retVal = gr.email+','gr.phone+','+gr.user_name+','+ gr.title.getDisplayValue() +','+gr.location.getDisplayValue()+','+ gr.department.getDisplayValue();
}
return retVal;
},
type: 'user_details'
});
CS:
function onChange(control, oldValue, newValue, isLoading) {
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;
}
}