- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:35 AM
Can we add getValue() with field value of type "String"?
Is it getDisplayValue() or getValue()?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:42 AM
Hello @KiranmaiP ,
Yes, you can use getValue() with a field of type String.
getValue() - Retrieves the actual value stored in the database
Example: When you need the raw data, like a sys_id or the exact value of a field.
var fieldValue = g_form.getValue('field_name');
getDisplayValue() - Retrieves the human-readable or display value that users see.
When you need the name, label, or description that is shown in the UI, especially for reference fields.
var displayValue = g_form.getDisplayValue('field_name');
If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:42 AM
Hello @KiranmaiP ,
Yes, you can use getValue() with a field of type String.
getValue() - Retrieves the actual value stored in the database
Example: When you need the raw data, like a sys_id or the exact value of a field.
var fieldValue = g_form.getValue('field_name');
getDisplayValue() - Retrieves the human-readable or display value that users see.
When you need the name, label, or description that is shown in the UI, especially for reference fields.
var displayValue = g_form.getDisplayValue('field_name');
If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:42 AM
Hi Varun,
Please go through this article: https://www.servicenow.com/community/in-other-news/how-to-use-getdisplayvalue-and-getvalue-for-glide...
I hope this will help you.
Please mark helpful if I answered correctly.