Reference field is showing sys id instead of label name in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:31 PM
I have one reference field and when I am modifying the widget and trying to show it on service portal , it is showing sys id instead of the display name. But I want display value.How to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:42 PM - edited 08-17-2023 11:44 PM
You have to personalize that list to add other fields you want .
Just click on the reference field ,you will see a list of items
Just right-click on the header bar and choose Personalize > List Layout like other places in the system, add some other fields on listview - eg-name etc and save the layout configuration
Refresh your form ,you will see display name instead of sysid's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:43 PM
In the Server Script of the widget, make sure you are using GlideRecord to fetch the record. When you are fetching the value of the reference field, use the getDisplayValue() method instead of getValue(). This will fetch the display value of the reference field instead of the sys_id.
Please mark it Correct and Hit Like if you find this helpful!
Regards,
Karthiga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:49 PM
you can use .getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:53 PM
Hello @Koel Goswami ,
In your server side script you must have did a glide record to your table where you are getting data for that reference field.
so what you can do is use .getDisplayValue().toString(); and then pass it to HTML
HOpe this helps
Mark my answer correct if this helps you
Thanks