We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Difference between getDisplayBox(), getValue() and getDisplayValue() method

vinuth v
Tera Expert

Hi All,

 

Can any one explain the difference between getDisplayBox(), getValue() and getDisplayValue() method in servicenow and when to use these methods.

 

Thanks in advance,

Vinuth

2 REPLIES 2

Bert_c1
Kilo Patron

SK Chand Basha
Kilo Patron

Hi @vinuth v 

 

To test this, open any form, like the Incident form in ServiceNow. Then, press Ctrl + Shift alt + j to access the browser-level JavaScript executor.

 

getDisplayBox() deals with the HTML element of the field, allowing direct manipulation of the form's user interface.

example: alert(g_form.getControl('short_description').getDisplayBox());

getValue() retrieves the raw data stored in the field, such as the sys_id for reference fields.

example: alert(g_form.getValue('caller_id'));

getDisplayValue() retrieves the user-friendly display value of the field, such as a user’s name instead of a sys_id.

example: alert(g_form.getDisplayValue('caller_id'));

 

Mark it Helpful and Accept Solution!! If this helps you to understand.