client script with glide ajax is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 01:06 AM
Hi Friends,
I have written a Script include made client callable with glide ajax. I am trying to fetch the caller manager into short description , when caller is changed. But its give the below error.
onChange script error: TypeError: gax.addParm is not a function function () { [native code] }
Client Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 08:50 AM - edited 05-08-2025 08:52 AM
I'm not sure what newValue would be since I can't see what field you have this client script set to trigger on, however the data you're pulling in with what you provided here won't work. For this line
ga.addParam("sysparm_caller", g_form.getDisplayValue('caller_id'));
you can't have a display value as you would need a sys ID, so you would need to use this instead
ga.addParam("sysparm_caller", g_form.getValue('caller_id'));
as your Script include needs a sys_id since you're using this line
var gr = new GlideRecord("sys_user");
if (gr.get(gx)) {
return gr.manager.name.toString();
}
which is looking using a sys_id.
Also, if your client script is scoped you may be running into a scoping issue. In that case take a look at this thread
Scoped App: onChange script error: TypeError: $ is not a function function () { [native code] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 09:51 AM
Hello @dvass0107
Try this script:
onChange client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax("GetManager");
ga.addParam("sysparm_name", "callerMgr");
ga.addParam("sysparm_caller", newValue); // use sys_id directly here
ga.getXMLAnswer(function(response){
if (response) {
var shortDesc = g_form.getValue('short_description');
g_form.setValue('short_description', 'Manager ' + response + ' - ' + shortDesc);
}
});
}
Script Include:
var GetManager = Class.create();
GetManager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
callerMgr: function() {
var callerId = this.getParameter('sysparm_caller');
var gr = new GlideRecord("sys_user");
if (gr.get(callerId) && gr.manager) {
return gr.manager.getDisplayValue(); // safer than .name
}
return '';
},
type: 'GetManager'
});
Note:
Carefully search the entire form’s Catalog Client Scripts for any addParm or any GlideAjax variable named gax.
It may be in a different script (onChange for another field, onLoad, etc.).
Fix any instance of addParm to addParam.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 02:29 AM
Hi Juhi,
Copied the same and tried with sys_id still same error,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 09:14 AM
Hi @dvass0107
Have you checked the other client scripts as well?
Carefully search the entire form’s Catalog Client Scripts for any addParm or any GlideAjax variable named gax.
It may be in a different script (onChange for another field, onLoad, etc.).
Fix any instance of addParm to addParam.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar