Problem calling a Script Include from a catalog client script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 10:48 PM - edited 05-01-2024 10:51 PM
Hello ServiceNow people.
I am getting following error while calling script include from catalog client script. I don't have clue. Can anybody help me out.
(running Client Script "test": ReferenceError: RestrictedOptionsUtil is not defined)
System Property:
script include:
var RestrictedOptionsUtil = Class.create();
RestrictedOptionsUtil.prototype = {
initialize: function() {},
getRestrictedOptions: function() {
return gs.getProperty('restricted_options');
},
type: 'RestrictedOptionsUtil'
};
Catalog Client Scripts :
Catalog Client Scripts :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '')
return;
var restrictedOptionsUtil = new RestrictedOptionsUtil(); // Instantiate the Script Include
var restrictedOptionsString = restrictedOptionsUtil.getRestrictedOptions(); // Retrieve restricted options from the system property
var restrictedOptions = restrictedOptionsString.split(',');
if (restrictedOptions.includes(newValue)) {
if (confirm("The selected option is restricted. If you want to request this service, please click OK to be redirected to the ServiceNow form.")) {
top.window.location = url;
g_form.clearValue('application'); // variable name it reference variable (table : u_application)
}
}
}
0 REPLIES 0