Include CI's for child classes on reference qualifier.

Shane Vidal-Hal
Kilo Contributor

Is it possible to create a configuration item reference qualifier to return all CI's from a parent class and include child class CI's as well. Currently you can specify individual classes but I would like to return all CI's below the server class for instance. I see there is a field called sys_class_path. Could this be used?

1 ACCEPTED SOLUTION

srphayre
Giga Contributor

Hi Shane,

 
There is a function called getTableExtensions which returns all of the extended tables from a base table.

 

More info here: https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_TU-getTableExtensions

 

Hope that helps!

 

Steve

ITSM Guy at Expedia Group

View solution in original post

7 REPLIES 7

srphayre
Giga Contributor

Hi Shane,

 
There is a function called getTableExtensions which returns all of the extended tables from a base table.

 

More info here: https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_TU-getTableExtensions

 

Hope that helps!

 

Steve

ITSM Guy at Expedia Group

Shane Vidal-Hal
Kilo Contributor

Hi Steve

Thanks this is eaxctly what I needed. I can now extract all the table names and compile a list of CI's from all child tables using a script include.

Regards

Shane

Dominik Simunek
Tera Guru

Hi all,

In case somebody finds this thread, I want to give it an update here. There is a nice feature which can be used in reference qualifiers and encoded queries - it is "INSTANCEOF" operator which allows you to easily query a base table with query like "sys_class_nameINSTANCEOFcmdb_ci_server" and it will return you all records from child classes (e.g. Windows Server, Linux Server etc.).

https://docs.servicenow.com/bundle/rome-platform-administration/page/script/server-scripting/concept...

You can also easily use it in the Condition Builder like "Class IS A Server". The operator "IS A" means "INSTANCEOF" while operator "IS" means simple equal operation. I found this super helpful and super easy. No need to script something to get CIs from a class including all the child classes.

Best regards,

Dominik