GlideElement - getDisplayValue(Number maxChar)

Gets the formatted display value of the field.

Table 1. Parameters
Name Type Description
maxChar Number Optional, maximum number of characters to return.
Table 2. Returns
Type Description
String Display value of the field.

Scoped equivalent

To use the getDisplayValue() method in a scoped application, use the corresponding scoped method: Scoped GlideElement - getDisplayValue(Number maxCharacters).

var fields = current.getFields();
for (var i = 0; i < fields.size(); i++) { 
  var field = fields.get(i);
  var name = field.getName(); 
  var value = field.getDisplayValue(); 
  gs.print(i + ". " + name + "=" + value); 
}