- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 06:41 AM
I have a catalog item where I have to validate that 16 fields contain only numbers. Validation should be done onChange for each of the 16 fields. I can create a global UI script and call it from the 16 onChange scripts, however as I understand this global script will load for all catalog items. Is there some way to define a function that is only available to other catalog client scripts in the same catalog item? I tried defining it in an onLoad script, but this didn't work.
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 08:00 AM
This is an age-old problem. You will have to write a client script for each field unfortunately.
I can propose an alternative...
Use the OOB Regex at the field level.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 04:47 AM - edited 12-21-2022 04:48 AM
Hi
You can easy create a "global" function within the catalog item by defining a function in an onload script. It needs to be declared outside the default onLoad function like this:
functionName = function() { //This function can be called from other onChange client scripts
//Add your function code here
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 08:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 04:47 AM - edited 12-21-2022 04:48 AM
Hi
You can easy create a "global" function within the catalog item by defining a function in an onload script. It needs to be declared outside the default onLoad function like this:
functionName = function() { //This function can be called from other onChange client scripts
//Add your function code here
};