I need a report list of all the class names in the CMDB_CI

PennyC
Tera Expert

We have had several integrations in our test instance of service now.  I need a list of all the class names in CMDB_CI table.  I could group by class name (which is 237 classes) I just want of list of the 237 class names not the over 3 million CI's that go with it.

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @PennyC 

 

Go to sys_db_object

 

AGLearnNGrow_0-1741698997985.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Thanks!  This did get me all the CMDB_CI class names.  I only want the CMDB_CI class names that have data in them, meaning CMDB_CI class names in use, some are empty.  Is there a way to tell that?

 

Thanks for your help!

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @PennyC 

 

Go to sys_db_object

 

AGLearnNGrow_0-1741698997985.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thanks!  This did get me all the CMDB_CI class names.  I only want the CMDB_CI class names that have data in them, meaning CMDB_CI class names in use, some are empty.  Is there a way to tell that?

 

Thanks for your help!

Hi @PennyC 

 

No mate, that's not possible automatically. What you can do is handle it manually. The way you get the 237 classes now, group them by the same category, copy the class names, and then go to Excel and paste them there.

 

AGLearnNGrow_0-1741701165025.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hello @PennyC 

 

Yes it can be done via script. 

 

var gr = new GlideAggregate('cmdb_ci');

gr.addAggregate('COUNT');

gr.groupBy('sys_class_name');

gr.query();

 

while (gr.next()) {

    var count = gr.getAggregate('COUNT');

    if (count > 0) {

        gs.info(gr.getValue('sys_class_name') + " -> CI Count: " + count);

 

    }

}

 

You can various other conditions here, count and all, I pulled out duplicates today on both name and serial number. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway,

 

Regards,

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY