
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2021 06:49 AM
I have a simple (?) idea but somehow I do not seem to get it working...
I want to create a catalog item so employees can enter there own tickets.
So i created a simple form which will result in a Incident.
I placed the 'category' field on the form.
And I also placed the field subcategory on the form.
Now I want to show the subcategories only based on the dependant value form category.
These values are in the 'sys_choice' table.
The values needed are "name=incident^element=subcategory^inactive=false"
The dependent value's here are the same as the values from the field category.
For example:
Category: Applications
Subcategory: ServiceNow, Salesforce, Excel, Word, Powerpoint.
Category: Connectivity
Subcategory: Wi-Fi, VPN, Bluetooth
The field category:
With the field subcategory i'm stuck.
I tried several type of fields Select Box, Lookup Select Box, Reference but I doesn't work correctly.
I tried a Reference qualifier, als did try a Catalog Client Script.
Currently it show all the values from the choice list, but i somehow does not use the dependant value.
Here is the example of the Catalog Client Script (on a secondary field 'subcat')
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '') {
g_form.setVisible('subcat', false);
} else {
g_form.clearOptions('subcat');
//get the possible values
var possibleChoices = new GlideRecord('sys_choices');
possibleChoices.addQuery('table', 'incident');
possibleChoices.addQuery('element', 'subcategory');
possibleChoices.addQuery('dependant_value', newValue);
while (possibleChoices.next()) {
g_form.addOption('subcat', possibleChoices.value, possibleChoices.label);
}
g_form.setVisible('subcat', true);
}
}
Somebody who can help me out?
I don't want the subcategories hard-coded in the script, but i want to make use of values in the choices table.
Thanks!
Solved! Go to Solution.
- Labels:
-
Incident Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2021 09:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2021 09:02 AM
You can do without scripting also
Category-Subcategory dependency in Service Catalog (Make variables dependent without scripting)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2021 11:52 PM
Thanks, this worked!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2021 09:38 PM