Notifications

9 views

Symptoms


It does, but when you have Dictionary Overrides for Display Value in place on extended tables like the CMDB, you expect using getDisplayValue() to give you the Display value specific to that record's Class (sys_class_name).

e.g. You may have a custom CI Class in the CMDB, where instead of using "Name", you wish for that CI to displayed with the value of some other field, maybe Asset Tag. But your scripts continue to return the CI 'Name' from this function.

Release


All.

Cause


You may be using the wrong class when you declare the GlideRecord. The Display value is taken from the GlideRecord object, not the specific record within that.

Resolution


Use the exact same class for the GlideRecord as of the record.

e.g. 53958ff0c0a801640171ec76aa0c8f86 is the sys_id of a Linux Server (sys_class_name=cmdb_ci_linux_server) in the Demo Data.

The cmdb.asset_tag field has had a Dictionary Override added for that Linux Server class, with 'Override Display' ticked.

var dave = new GlideRecord('cmdb_ci'); // This is the top level table for IT-based CIs. 
dave.get('53958ff0c0a801640171ec76aa0c8f86'); 
gs.print(dave.getDisplayValue()); // This will use 'name' because that is still what cmdb_ci defaults to.

output 
*** Script: lnux100 

var dave = new GlideRecord('cmdb_ci_linux_server'); // this is the actual class of this record
dave.get('53958ff0c0a801640171ec76aa0c8f86'); 
gs.print(dave.getDisplayValue());  // This will use asset_tag, because it will now use the cmdb_ci_linux_server specific override

output 
*** Script: P1000165 

 

Article Information

Last Updated:2019-01-11 06:56:03
Published:2018-11-08