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-22-2025 04:09 AM
Hi Juhi,
Sorry for late reply, I am revisiting this as I had to look into other priority work.
As you said there was another script having gax as a variable, which I have disabled and tried. Now that error is not coming. But short description is not updating with new caller name.
Regards,
Srinivas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 07:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 12:55 AM
Hi Juhi,
PFB code:
Client script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 10:53 AM
Hello @dvass0107
Please try this onchange client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var ga = new GlideAjax("GetManager");
ga.addParam("sysparm_name", "callerMgr");
ga.addParam("sysparm_caller", newValue);
ga.getXMLAnswer(function(response) {
if (response) {
//g_form.addInfoMessage("response received");
var shortDesc = g_form.getValue('short_description');
g_form.setValue('short_description', 'Manager ' + response + ' - ' + shortDesc);
//g_form.addInfoMessage(g_form.getValue('short_description'));
}
});
}
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'
});
Result:
Note:
- Make sure the new callers manager field is not empty.
- Script Include is client callable/ Glide AJAX Enabled. If not then create a fresh new script include with client callable/ Glide AJAX Enabled checked.
This is tested in my PDI, and it worked for me.
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-23-2025 01:20 AM
Hi Juhi,
PFB code:
Client Script: