Script Include Returning Null in answer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi,
So, I am using this catalog client script
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');
}
});
}
With this Script Include
With this Script Include
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'
});
But The answer I am getting is null.
The Script Include is client callable so I am unable to figure it out.
Thanks in advanced.
But The answer I am getting is null.
The Script Include is client callable so I am unable to figure it out.
Thanks in advanced.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
@ManishS14752344 You can put some gs.info statements at various stages of the server script and check the logs to see if the logic is flowing at each stage.
All I am suggesting is, instead of looking for final output, you can put log statements at every stage and see.
