The Zurich release has arrived! Interested in new features and functionalities? Click here for more

CMDB classes

Dikshmalik
Tera Contributor

Hi Team

I have a requirement to find out the list of all the available classes in CMDB_CI and other child tables related to it so that we can use the same when using baseline functionality for various CI. We have more than 1 million CI records so its not possible to take the extract of all the records in excel and then sort the data. Can somone please let me know how i can manually get the list of all the CI classes without taking extract of such huge data.

I tried running background script :

var ab= new GlideRecord('cmdb_ci');

ab.query();

var cn=ab.getRowCount();

while(ab.next())

{

gs.print(ab.sys_class_name);

}

But this resulted in few classes even though the CI number was same to the number of CI's in the system but i am unable to get the full list of classes. I also tried the group By option but it only results in records that has CI's and i need empty classes.I tried it in my PDI.

find_real_file.png

Thanks and Regards

Dikshit Malik

Message was edited by: Dikshit Malik Please see the attached image to get a better understanding.

1 ACCEPTED SOLUTION

This will get you an entire list of the cmdb_ci table structure.



var table = new TableUtils("cmdb_ci");


var ciTableList = j2js(table.getAllExtensions());


for (var i = 0; i < ciTableList.length; i++) {


  gs.print(ciTableList[i]);


}


View solution in original post

14 REPLIES 14

Chuck Tomasi
Tera Patron

Hi Dikshit,



Were you able to get your answer to this query?


Hi Chuck



I was not able to extract all the information. I am manually inserting the class names in my transform map query.



Thanks and Regards


Diksh Malik


This will get you an entire list of the cmdb_ci table structure.



var table = new TableUtils("cmdb_ci");


var ciTableList = j2js(table.getAllExtensions());


for (var i = 0; i < ciTableList.length; i++) {


  gs.print(ciTableList[i]);


}


Thanks team for all your efforts..Thanks Chuck for your generosity!!



Diksh Malik


You are very welcome. I'm glad you got your question answered.