on incident form it is show this at caller field "onChange script error: ReferenceError: caller_i"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 12:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 01:17 AM
Hello @Kongaleti Navee ,
Yes you can debug both scripts by adding the logs inside, please refer the below scripts with added logs.
Script Include:
var SI_ReturnUserDetails = Class.create();
SI_ReturnUserDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
returnDetails: function () {
var sys_id = this.getParameter('sysparam_caller_id');
gs.log("SI_ReturnUserDetails - sysparam_caller_id: " + sys_id);
var gr = new GlideRecord('sys_user');
gr.get(sys_id);
var usrobj = {
email: gr.email.toString(),
firstName: gr.firstName.toString(),
lastName: gr.lastName.toString()
};
var userDetailsString = JSON.stringify(usrobj);
gs.log("SI_ReturnUserDetails - UserDetails: " + userDetailsString);
return userDetailsString;
},
type: 'SI_ReturnUserDetails'
});
Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var callerId = g_form.getValue('caller_id');
g_form.addInfoMessage("Client Script - Caller ID: " + callerId);
var ga = new GlideAjax('SI_ReturnUserDetails');
ga.addParam('sysparam_name', 'returnDetails');
ga.addParam('sysparam_caller_id', callerId);
ga.getXML(displayUserDetails);
function displayUserDetails(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.addInfoMessage("Client Script - Response: " + answer);
var result = JSON.parse(answer);
setFormValues(result);
}
function setFormValues(userDetails) {
g_form.setValue('u_email', userDetails.email);
g_form.setValue('u_firstname', userDetails.firstName);
g_form.setValue('u_lastname', userDetails.lastName);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 01:25 AM
@Kongaleti Navee Please update your client script as follows.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('SI_ReturnUserDetails');
ga.addParam('sysparam_name','returnDetails');
ga.addParam('sysparam_caller_id',g_form.getValue('caller_id'));
ga.getXML(displayUserDetails);
function displayUserDetails(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
var result = JSON.parse(answer);
g_form.setValue('u_email',result.email);
g_form.setValue('u_firstname',result.firstName);
g_form.setValue('u_lastname',result.lastName);
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 02:14 AM
can any on please tell me where did i make the mistake

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 02:17 AM
@Kongaleti Navee This is the line where you made the mistake in your client script.
ga.addParam('sysparam_caller_id',g_form.getValue(caller_id));
You didn't use quotes while using the caller_id field. It should have been as follows.
ga.addParam('sysparam_caller_id',g_form.getValue('caller_id'));
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 12:05 PM
Hello @Kongaleti Navee ,
Is there any update on my response? if my response was helpful in addressing your query or If it assisted you in resolving your issue, kindly consider marking it as helpful, accepting the solution, and closing the thread. Doing so will not only acknowledge the assistance provided but also benefit future readers who might encounter a similar problem.
Thank you! 😁
Aniket.