Reference field is showing sys id instead of label name in service portal

Koel Goswami
Tera Contributor

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?

5 REPLIES 5

manjusha_
Kilo Sage

@Koel Goswami 

 

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

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact
 
Thanks,
Manjusha Bnagale

Karthiga S
Kilo Sage

Hi @Koel Goswami 

 

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

Harish Bainsla
Kilo Patron
Kilo Patron

you can use .getDisplayValue(); 

Mohith Devatte
Tera Sage
Tera Sage

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