How to Filter CIs based on selection of Class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 12:41 AM
Hello All,
We have two variables in service now form.
1. Choose which class is the CI ? ( it's a Dropdown variable )
(Example: Below are the dropdown list )
Network Gear
Printer
Server
Computers
2. Select CI ? (Reference variable ) Here, Our requirement is filter the CIs based on above class selection.
Any help would be greatly appreciated.
Thankyou,
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 03:49 AM
The easiest way to accomplish this is to set the value of each choice to it's sys_class_name - so cmdb_ci_netgear, cmdb_ci_printer,...
Then, on your Select CI reference variable, which should be a reference to the cmdb_ci table, you can use a reference qualifier like this:
where v_class is the name of the select box variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 02:44 AM
Hello @Brad Bowman ,
I have tried the same process. However it's not working fine. Please review below screenshot and assist me on this.
Thankyou,
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 04:30 AM
Did you try with just the 'sys_class_name...' part in case one of the other criteria is preventing it from working? ^EQ is unnecessary, but I don't know if that would break it. Did you copy this query after manually filtering the cmdb_ci list view? You can also try adding a Variable attribute
ref_qual_elements=v04_Which_Category_Class_Is_The_CI_Related
Another thing to do to troubleshoot is to create a temporary onChange Catalog Client Script when the category variable changes with an alert using g_form.getValue('v04_Which_Category....'). This will confirm that the value matches what appears when manually filtering a list view and what the reference qualifier is expecting (cmdb_ci_computer,...).