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

ayman_h
Kilo Sage
Kilo Sage

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

3 REPLIES 3

Matthew Smith
Kilo Sage

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));

 

 

Robbie
Kilo Patron
Kilo Patron

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

 

Screenshot 2024-08-15 at 13.42.29.png

ayman_h
Kilo Sage
Kilo Sage

Thanks @Matthew Smith @Robbie. Thats quite helpful!