- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 05:53 AM
Hi everyone,
I’m currently learning ServiceNow and got confused between the usage of getValue() and getDisplay() methods in scripts.
Can someone clearly explain:
What is the difference between getValue() and setDisplayValue()?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:53 AM
Hi @22eg105p57 ,
getDisplayValue() is used to retrieve the displayed (user-friendly) value of a field. For example, if you're working with a reference field like "assigned_to", this method will return the user's name.
getValue(), on the other hand, retrieves the actual stored value in the database, which may differ from the display value. For reference fields, it typically returns the Sys ID or a unique value.
setDisplayValue() method sets the value of a reference field by using its display value (e.g., a user's name instead of their sys_id).
For Better understanding please go through: How to use getDisplayValue() and getValue() for ... - ServiceNow Community
If my response solves your query, please marked helpful by selecting Accept as Solution and Helpful. Let me know if anything else is required.
Thanks,
Prerna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:14 AM
answer to your question is easily available on google, docs etc
You could have searched that to save time
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:14 AM
Hi @22eg105p57 ,
getValue() will the "real" value of the field where getDisplayValue() will get the displayed value instead - e.g. not SysID for reference fields.
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 06:53 AM
Hi @22eg105p57 ,
getDisplayValue() is used to retrieve the displayed (user-friendly) value of a field. For example, if you're working with a reference field like "assigned_to", this method will return the user's name.
getValue(), on the other hand, retrieves the actual stored value in the database, which may differ from the display value. For reference fields, it typically returns the Sys ID or a unique value.
setDisplayValue() method sets the value of a reference field by using its display value (e.g., a user's name instead of their sys_id).
For Better understanding please go through: How to use getDisplayValue() and getValue() for ... - ServiceNow Community
If my response solves your query, please marked helpful by selecting Accept as Solution and Helpful. Let me know if anything else is required.
Thanks,
Prerna