The CreatorCon Call for Content is officially open! Get started here.

How to Filter CIs based on selection of Class

Balasai peela
Tera Contributor

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

 

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

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:

BradBowman_0-1699530481308.png

where v_class is the name of the select box variable

 

 

Hello @Brad Bowman  ,

 

I have tried the same process. However it's not working fine. Please review below screenshot and assist me on this.

 

Balasaipeela_0-1699612988990.png

 

 

Thankyou,

Bala

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,...).