getDisplayValue()
Both the GlideRecord and GlideElement classes contain a getDisplayValue() method. While the method of the GlideRecord object (gr.getDisplayValue()) gets the display value for the record based on the field that's marked as the Display Value in the field dictionary, the getDisplayValue() method of the GlideElement class (gr.field_name.getDisplayValue()) gives you the value that is displayed for the field's value.
You might think a field's value is what it is, but certain field types can have a disparity between the actual value, and the display value. For example, drop-down fields can have a label as well as a value. It's the value that gets stored in the actual database. Similarly, reference fields have both display values ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access