Script Include returning null?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 12:11 AM
Hi all,
The following Script returning null value. I need consumer sys_id. Thanks in advance
Script Include -
var customerPhones = Class.create();
customerPhones.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
ConsumerS: function() {
var g = this.getParameter('syparm_cons');
var CONsumer = '';
gs.info("Include::::" + g);
var gr1 = new GlideRecord('sn_customerservice_product_service_support');
gr1.addQuery('sys_id', g);
gr1.query();
if (gr1.next()) {
CONsumer = gr1.consumer;
}
return CONsumer;
},
Client Script -
var ans = '';
var con = g_form.getValue('parent');
var ga1 = new GlideAjax('sn_customerservice.customerPhones');
ga1.addParam('syparm_name', 'ConsumerS');
ga1.addParam('syparm_cons', con);
ga1.getXML(HelloWorld);
function HelloWorld(response) {
ans = response.responseXML.documentElement.getAttribute("answer");
alert(ans);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 02:09 AM
Hey Aman,
Yes, make sense.
@Siddharam if you need more field from that record then you can use getReference, if you need only one value then its better to go with GlideAjax.
Regards,
Abhijit
ServiceNow MVP