Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Problem calling a Script Include from a catalog client script

prudhvi67
Tera Contributor

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:

prudhvi67_0-1714624834702.png

 



script include:

var RestrictedOptionsUtil = Class.create();
RestrictedOptionsUtil.prototype = {
initialize: function() {},

getRestrictedOptions: function() {
return gs.getProperty('restricted_options');
},

type: 'RestrictedOptionsUtil'
};

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