Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 06:39 PM
Try adding an alert() to check g_form.getUniqueValue() is returning a value.
function onLoad() {
try {
var catSysID = g_form.getUniqueValue();
alert(catSysID);
var ajax = new GlideAjax('ServiceCatalog');
ajax.addParam('sysparm_name', 'getServiceCatalog');
ajax.addParam('sysparm_cat_sys_id', catSysID);
ajax.getXMLAnswer(function(answer) {
if (answer.length > 0) {
if (answer == 'comapny') { // mispelling of 'company' intended?
g_for.setValue('no_order_now',true);
}
}
});
} catch (e) {
alert(e.message);
}
}
If the alert is showing a value, check Script Include's "Client callable" is checked and the name of the Script Include is "ServiceCatalog". If changing the name, ServiceCatalog in Client Script's GlideAjax('ServiceCatalog') also needs to be changed to the new name.