How to identify an added field on a table in a Dictionary entry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 02:50 AM
Hi,
If we have a table that is extended from another table, is there an attribute within the Dictionary entry that indicates its from the extended table? For e.g Virtual Machine Object table extends the Configuration Item, the field 'Object ID' is an added field I can see on the CI Class Manager but is there a field within the Object ID dictionary entry that I could use to identify this?
Thanks,
Ayman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 03:25 AM - edited ‎08-15-2024 03:27 AM
I'm not aware of an attribute that shows this, but with credit to this reddit post, it looks like you can determine it via script. Something like this could work?
var fieldName = 'object_id';
var tableName = 'cmdb_ci_vm_object';
var td = GlideTableDescriptor.get(tableName);
var ed = td.getElementDescriptor(fieldName);
gs.print('First table: ' + ed.getFirstTableName());
gs.print('Is inherited: ' + !(ed.getFirstTableName() == tableName));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 05:47 AM
Hi @ayman_h,
Interesting question.... To answer your question directly, there is no attribute in the Dictionary entry or at the Table ('sys_db_object') level to determine this sadly.
@Matthew Smithhas provided handy script to help confirm on an script basis - Kudos.
There is a nice-ish graphical way to confirm the inheritance model and ERD via the 'Show Schema Map'. You can either navigate to this by type 'Tables & columns' into the Navigation menu, or, from the Dictionary table, click on 'Advanced View', then 'Show Table' and then thirdly 'Show Schema Map'.
As shown below (Hopefully it's not too small) you can see the only columns within the Virtual Machine Object table ('cmdb_ci_vm_object') is the Object ID and Server columns - 2 in total, all the rest are inherited from the CI Table and Base CI table.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

Thanks, Robbie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 06:23 AM
Thanks @Matthew Smith @Robbie. Thats quite helpful!