What It Does

The getDisplayValue() method retrieves the human-readable representation of a field's value rather than its stored database value. This is particularly crucial for reference fields, where the database stores a sys_id but users need to see meaningful text like a user's name or an incident number. For choice fields, it returns the display label ("High") instead of the stored numeric or string value ("1" or "high").

ServiceNow executes this method by performing a lookup operation. For reference fields, it queries the referenced table to retrieve the display value of the target record. For choice fields, it consults the choice list configuration to map the stored value to its label. The platform caches these lookups within the current transaction, so multiple calls to the same field don't trigger repeated database queries.

The method returns a string in all cases, but the content varies by field type. For regular text fields, it returns the same value as getValue(). For date/time fields, it returns a formatted string according to the user's locale settings. For reference fields pointing to deleted records, it returns an empty string. For fields that contain invalid choice values (values not in the current choice list), it returns the stored value itself.

Edge cases include reference fields with multiple levels of reference (dot-walking), where getDisplayValue() only resolves the immediate reference, not the chain. Journal fields return the plain text content without HTML formatting. Currency fields include the currency symbol in the display value. Boolean fields return "true" or "false" as strings, not boolean values.

This method complements getValue() by providing the presentation layer value instead of the data layer value. While toString() also returns display values, getDisplayValue() allows you to specify exactly which field you want the display value from, making it more explicit and safer for code maintenance.

When to Use This

Use getDisplayValue() when building notifications, generating reports, or creating any user-facing output where you need human-readable values. This is essential for reference fields in email templates, UI messages, or log entries that administrators will read. Choice fields particularly benefit from this method since raw choice values ("1", "2", "3") mean nothing to users compared to their labels ("Low", "Medium", "High").

Avoid this method when performing comparisons, database operations, or any logic that depends on exact values. Use getValue() instead for conditional logic or when setting field values on other records. Never use display values for queries or filters – they're presentation data, not operational data. For URL parameters or REST API calls, stick with getValue() to ensure consistent, locale-independent behavior.

The most common misuse is trying to query records using display values obtained from getDisplayValue(). This fails because queries expect stored values, not display values. Another mistake is using display values in business logic comparisons, where locale-specific formatting or translations can break the logic unexpectedly.

Return Value

The method always returns a string, even for numeric or boolean fields. The string is formatted according to the current user's locale and timezone settings for date/time fields. For reference fields, it returns the display value from the referenced record's display field (usually "name" or "number"). For choice fields, it returns the exact label text as configured in the choice list, including any special characters or spacing.

On failure or when data is missing, the method returns an empty string ("") rather than null or undefined. This occurs when the field doesn't exist, when a reference field points to a deleted record, or when a reference field is empty. The empty string behavior makes it safe to concatenate or use in string operations without null checks, but you should still validate the result if empty values would break your logic.

Free Newsletter

Enjoying this? Get one deep-dive per week.

Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.

No spam · Unsubscribe anytime

Platform Behavior & Side Effects

  • No Business Rules, Script Engines, or notifications fire – this is a read-only operation that doesn't modify data
  • Database queries execute for reference field lookups, but results are cached within the current transaction
  • Performance is generally fast for simple fields and choice lookups, but reference fields can be slower due to additional table queries
  • ACL (Access Control List) checks apply to referenced records – you won't get display values from records you can't read
  • No audit records are created since no data modification occurs
  • Behavior is identical across Business Rules, Script Includes, and Scheduled Jobs – no context-dependent variations
  • User session locale and timezone settings affect the formatting of date, time, and currency display values