There is a JavaScript error in your browser console
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 11:13 AM
Hello Community members ,
I'm trying to populate couple of variables in a catalog item and seeing an issue. The glide Ajax call that I'm making is fetching the info and populated in the variables in the nativeUi as expected. However I'm facing an issue with it in the browser.
Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = new GlideAjax('setADInfo');
gr.addParam('sysparm_name', 'getInfo');
gr.addParam('sysparm_fileSharepath', g_form.getValue('fileshare_path'));
gr.getXML(showMessage);
function showMessage(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer) {
answer = answer.evalJSON();
g_form.setValue('managed_by', answer.managedby);
g_form.setValue('ad_group', answer.adgrp);
}
}
}
Script Include:
var setADInfo = Class.create();
setADInfo.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getInfo: function() {
var obj = {};
var sysId = this.getParameter('sysparm_fileSharepath');
var getInfo = new GlideRecord("u_cae_fileshare_details");
getInfo.addQuery('sys_id', this.getParameter('sysparm_fileSharepath'));
getInfo.query();
if (getInfo.next()) {
obj.managedby = getInfo.getDisplayValue('u_managedby');
obj.adgrp = getInfo.getDisplayValue('u_ad_group');
var json = new JSON();
var data = json.encode(obj);
}
return data;
},
type: 'setADInfo'
});
Appreciate your assistance.
Thanks,
SK
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 12:38 AM
Hello Sunil,
Can you please share more on the issue on the browser side.
You can also go through this link if its help you:
https://www.servicenow.com/community/developer-blog/mini-lab-using-ajax-and-json-to-send-objects-to-...