- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 04:39 AM
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.
Thanks and Regards
Dikshit Malik
Message was edited by: Dikshit Malik Please see the attached image to get a better understanding.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 06:39 AM
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]);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 05:51 AM
Run this in a background script...it'll give you classes and count.
var count = new GlideAggregate('cmdb');
count.addAggregate('COUNT', 'sys_class_name');
count.query();
while (count.next()) {
var taskType = count.sys_class_name;
var taskTypeCount = count.getAggregate('COUNT', 'sys_class_name');
gs.log(taskTypeCount + " in " + taskType);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 03:00 AM
Hi Victor,
The above mentioned script doesnt gives accurate results. When i use the above it gives me only 17 lines but as per my shared screenshot, the application drop down has 100+ class types. Is there any way to include all the available options under class drop down.
Also i tried group by class name but it only provides lines that have associated CI's and not empty classes. Please suggest something as i need all the available classes to auto map my target table during transformation. I am using a transform map script to map data in target table using Class field.
Thanks and Regards
Diksh Malik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 06:34 AM
Hi Diksh,
The following may help:
http://www.nashcosolutions.com/wp-content/uploads/2016/05/ServiceNow-Data-Model-v3.4.pdf
Thanks,
Berny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 04:47 AM
Hi Dikshit,
The following wiki article has a graphical map of the cmdb_ci hierarchy:
http://wiki.servicenow.com/index.php?title=CMDB_Data_Model#gsc.tab=0
Alternatively, you can find a list of all extended tables in Service Now here:
http://wiki.servicenow.com/index.php?title=Tables_and_Classes#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 07:27 AM