Client Script Returning Null
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi,
So I have this combination of onChange client script and script include
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) return;
var ga = new GlideAjax('AccountSTOChecker');
ga.addParam('sysparm_name', 'checkStoreOrder');
ga.addParam('sysparm_account_id', newValue);
ga.getXMLAnswer(function (answer) {
if (answer === null) {
console.error('GlideAjax returned NULL - Script Include not reachable');
return;
}
console.log('Account STO Type stored:', answer);
sessionStorage.setItem('accountSTOType', answer);
if (answer === 'true') {
g_form.addInfoMessage('STO Account - attachment required');
}
});
}
var AccountSTOChecker = Class.create();
AccountSTOChecker.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkStoreOrder: function () {
var accountId = this.getParameter('sysparm_account_id');
if (!accountId)
return 'false';
var acc = new GlideRecord('customer_account');
if (!acc.get(accountId))
return 'false';
var type = acc.getValue('u_so_sto');
if (type == '2') {
return 'true';
}
return 'false';
},
type: 'AccountSTOChecker'
});
The answer is returning in null and I cannot figure out why.
The answer is returning in null and I cannot figure out why.
0 REPLIES 0
