i am not getting any alerts on glide ajax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:16 AM
Hi,
Can you please let me know why my alert is not getting triggered?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
alert("inside ajx");
var get_Caller_Details = g_form.getValue("caller_id");
var ga = new GlideAjax("multiple_Autopopulate_Class");
ga.addParam("sysparm_name","multiple_Autopopulate_Function" );
ga.addParam("sysparm_id", get_Caller_Details);
ga.getXML(callBackFunction);
function callBackFunction(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
alert("response is " + response);
alert("answer is " + answer);
}
}
var multiple_Autopopulate_Class = Class.create();
multiple_Autopopulate_Class.prototype = Object.extendsObject(AbstractAjaxProcessor, {
multiple_Autopopulate_Function: function() {
var parm = this.getParameter("sysparm_id");
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", parm);
gr.query();
if (gr.next()) {
return gr.email + ", " + gr.location + ", " + gr.manager;
}
},
type: 'multiple_Autopopulate_Class'
});
Regards
Suman P.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:49 AM
Which alert particularly is not triggered? Also, I see the script is onChange(). Hope you are checking post change of Caller field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:52 AM
Hi @Jaspal Singh ,
I am changing the caller field, but the alert is not triggered. Inside Ajax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:55 AM
Hello @Community Alums
Instead of alert(), Use gs.log();
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:57 AM
I am using the alert on the client-side right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:51 AM
You should be able to see at least the 1st alert() message.
Also, open your browser console and check for errors.
Additionally - not sure why you use Pascal case for naming, but it would be better to use CamelCase. For script includes - should start with capital letter - MultipleAutoPopulateClass (best skip Class if you ask me). For methods in the SI - multipleAutoPopulateFunction (I'd remove the function from the name also. USe some verb instead - multipleAutoPopulSet or smtn).