Client Script - Concerning Reference Fields getDisplayValue vs getDisplayBox
So most ServiceNow consultants will run an AJAX server-side call to the database to retrieve the the Display Value of a Reference field. This is of course SerivceNow's own best-practice MO.
However, this invokes server-side logic that is unnecessary when the browser is storing this on the client side. Inspect your source on the client end (Chrome Dev Tools in my case) and you can use the following in your client script to retrieve the display value instead of the usual sys_id that is retrieved:
g_form.getDisplayBox('field_name').value
OR
g_form.getValue(g_form.getDisplayBox('field_name').id)
To get a Choicelist/DropDown list display value -
For regular forms, use this:
var disp = g_form.getDisplayBox("field_name").value;
In the Service Catalog, you may have to use this instead:
var varDisp = g_form.getDisplayBox(g_form.resolveNameMap("variable_name")).value;
Bingo!














