- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 01:17 AM
Hi,
I am working on GlideAJAX Script Include and I am facing this issue. Kindly help.
GlideAJAX
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('locationDetailsClass');
ga.addParam('sysparm_name', 'locationDetailsFunction');
ga.addParam('sysparm_ID'. newValue);
ga.getXML(callBackFunction);
function callBackFunction(response){
var answer = response.responseXML.documentElement.getAttribute('answer');
var op = JSON.parse(answer);
g_form.setValue('project_city', op.callCity);
g_form.setValue('project_street', op.callStreet);
g_form.setValue('project_state_province', op.callState);
g_form.setValue('project_zip_postal_code', op.callZip);
g_form.setValue('cost_center', op.costCenter);
}
}
Script Include
var locationDetailsClass = Class.create();
locationDetailsClass.prototype = Object.extendsObject(AbstractAjaxProcessor, {
locationDetailsFunction: function(){
var keyFunction = this.getParameter('sysparm_ID');
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', keyFunction);
gr.query();
if(gr.next()){
var jsonObj = {};
jsonObj.callCity = gr.getValue('city');
jsonObj.callStreet = gr.getValue('street');
jsonObj.callState = gr.getValue('state');
jsonObj.callZip = gr.getValue('zip');
jsonObj.costCenter = gr.getDisplayValue('cost_center');
return JSON.stringify(jsonObj);
}
},
type: 'locationDetailsClass'
});
Regards
Suman P.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 06:46 PM
@Dave_p Didn't you raise the same question on a separate thread. The issue lies in line
ga.addParam('sysparm_ID'. newValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 03:08 PM - edited 01-16-2025 03:38 PM
Hi @Dave_p ,
Based on detail shared, the onChange script is running on "Requested For Associate Info" and you are calling GlideAjax and reading the other project details from User[sys_user] table via passed sys_id,
It means that the "Requested For Associate Info" is reference type on form pointing to User [sys_user] table, correct ? and you are trying the set other field values. You can set the city,street,state values via Auto-populate.
Open each field and set the dependent question "Requested For Associate Info" and Set the respective value in "Dot Walk Path" field.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 05:21 PM
You have a typo here:
ga.addParam('sysparm_ID'. newValue);
This is equivalent to calling addParam with undefined as an argument. Instead, you can fix this to use a comma , instead of a dot .:
ga.addParam('sysparm_ID', newValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 06:25 PM
good catch, i didn't notice that. 😎
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 06:46 PM
@Dave_p Didn't you raise the same question on a separate thread. The issue lies in line
ga.addParam('sysparm_ID'. newValue);