When looking at dictionary entries, how can you tell if it is a cloned descendent of another one further up the hierarchy?

Daniel A-C
Tera Expert

Background

I went to a new client and I was searching for any dictionary entry that references a particular table. I was surprised to see that they'd apparently defined a dictionary entry with the same name on all of the classes in their CMDB. I opened one of them and it said...

"This cloned descendant element is read-only, Click here to open editable first element (cmdb_ci.u_custom_column) in a new window."

I thought it was odd, so in the same instance, I went to look at incident.state - which didn't exist as of course it is task.state. So, my own research has led me to understand that this is caused by which table flattening strategy is in use, Table per Class, Table per Hierarchy or Table per Partition. I understand that because the Base CI table uses Table per Partition, then all descendent classes use the same strategy, whereas Task uses Table per Hierarchy.

Question

'Ok' I thought, now I understand. But when looking at a list of dictionary entries, how can I tell if it is a cloned descendent of another one further up the hierarchy or one defined at that class?

I simply want to understand which dictionary entries are actually defined at each class without having to open each one. It seems that there is an entry for every attribute at every level of the class hierarchy. (I.e. cmdb_ci_computer.operational_status)

 

3 REPLIES 3

David Ramirez
Kilo Guru

It would be interesting to see what triggers the "This cloned descendant element is read-only, Click here to open editable first element (cmdb_ci.u_custom_column) in a new window." message, maybe an on display business rule, maybe a client script using a server call? that may give us a clue.

I'll try to look into it when I get a chance

This message is coming from a Display BR on the sys_dictionary table called "Display first table name for TPP tables".

The condition is GlideDBObjectManager.isPartitionedTable(current.getValue("name")), so not a simple change to the filter, I don't think. That's really all I know at this point.

Thanks for the suggestion about this being a business rule. I'd forgotten about the Display option.

Alex Mittell
ServiceNow Employee
ServiceNow Employee

Example script to get tables that are not cloned descendant elements (aka, not inherited from a parent table).

var arr_fields=[];
var fields = new GlideRecord('sys_dictionary');
fields.addQuery('name','target_table_name');
fields.addEncodedQuery('internal_type!=collection^ORinternal_type=NULL');//To ignore all the table dictionaries(optional)
fields.query();
while(fields.next())
{
    var td = GlideTableDescriptor.get(fields.getValue("name"));
    var ed = td.getElementDescriptor(fields.getValue("element"));
    if (ed == null || ed.isFirstTableName()) {
        arr_fields.push(fields.column_label.toString()+"("+fields.element.toString() + ")" );
    }
}
for(var i=0; i<arr_fields.length; i++)
{
    gs.print(arr_fields[i]);
}