Filter CI to some certain classes in INC form

Johnson13
Kilo Guru

Please I need help to write a script include  that will filter CIs to some classes in INC form. classes includes: 
Application
Business Service
Business Application
Business capability
Hardware
Storage Device
Voice System Hardware.

 

the Idea is that we do not want to expose all the CIs in the cmdb to Caller/service desk. we want to limit them to those classes only. 

 

Any help will highly be appreciated

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

Hi,

you can set the filter condition in the field by configuring the dictionary for cmdb field on incident form to show only those classes; create a dictionary override record for incident table and override reference qualifier as true; ref qualifier as below

sys_class_name=cmdb_ci_business_app^ORsys_class_name=cmdb_ci_service^ORsys_class_name=cmdb_ci_business_capability^ORsys_class_name=cmdb_ci_hardware^ORsys_class_name=cmdb_ci_storage_device^ORsys_class_name=cmdb_ci_volume_template^EQ

Ensure you give all class names correctly; In order to get this condition/filter go to cmdb table and apply the filter condition for your classes; copy the query and paste it in ref qualifier

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Ian Mildon
Tera Guru

Here is an example Script Include filter which you would call from the Reference qual entry with:

javascript:getFilteredCIs()

 

function getFilteredCIs(){

    var ciClassListProperty = 'cmdb_ci_aix_server,cmdb_ci_business_app,cmdb_ci_computer,cmdb_ci_config_file,cmdb_ci_esx_server,cmdb_ci_hardware,cmdb_ci_hpux_server,cmdb_ci_ip_switch,cmdb_ci_lb_netscaler,cmdb_ci_linux_server,cmdb_ci_peripheral,cmdb_ci_personal_printer,cmdb_ci_printer,cmdb_ci_print_queue,cmdb_ci_rack,cmdb_ci_scanner,cmdb_ci_server,cmdb_ci_service,cmdb_ci_solaris_server,cmdb_ci_unix_server,cmdb_ci_win_server,u_application_interface,u_application_module,u_monitor,cmdb_ci_comm,cmdb_ci_ip_phone';   
    var ciArr = ciClassListProperty.split(',');   
    var str = '';   
    for (i=0; i<ciArr.length;i++)   
    {   
    if (str == '')   
           str += 'sys_class_name='+ciArr[i];   
    else   
           str += '^ORsys_class_name='+ciArr[i];   
    }   
    return str;   
    }

Thanks for your help, this is what I came up with:

 

find_real_file.png

Hi,

you can easily do this for incident table using dictionary override

Did you check my previous comment?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader