GlideAjax returning null from Script Include

NishmithaS
Mega Contributor

I'm trying to convert List Collector sys_ids to user names using GlideAjax. The List Collector returns comma-separated sys_ids, which I pass to a client-callable Script Include. However, the GlideAjax response is always null.

 

Script include 

var getwatchlistusernames = Class.create();
getwatchlistusernames.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getName: function() {
var ids = this.getParameter('sysparm_ids');
var names = [];

var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', 'IN', ids);
gr.query();

while (gr.next()) {
names.push(gr.getValue('name'));
}

return names.join(',');
},

type: 'getwatchlistusernames'
});

 

Catalog Client script 

var ga = new GlideAjax('getwatchlistusernames');

ga.addParam('sysparm_name', 'getName');

ga.addParam('sysparm_ids', g_form.getValue('user'));

 

ga.getXMLAnswer(callback);

 

function callback(response) {

    alert(response);

    // g_form.setValue('short_description', response);

}

0 REPLIES 0