How to get the display name of reference field if using g_form.getReference

Priyanka132
Giga Contributor

Hi All,

I am using g_form.getReference to populate users details in a catalog item via client script. For a few fields in user profile like Business Unit, Department, cost center, I am getting the sys_id instead of the display value.

Since these fields are reference field , the value returned is sys id. How can i get the display value instead of the sys id.

 

find_real_file.png

 

var user= g_form.getReference('requested_for');
g_form.setValue('business_unit',user.u_business_unit.u_name);    ///business unit is a reference field on user table

 

I understand i can use asynchronous glide record in the client script to populate. but not sure if that is recommended

 

 

 

 

 

1 ACCEPTED SOLUTION

ArunKRam
Giga Expert

Hi Priyanka,

I think the best way to achieve this is by using Glide Ajax. Send the sysid to the script include, query the tables and return all the display values in an array.

Thanks,

Arun

View solution in original post

12 REPLIES 12

Upender Kumar
Mega Sage

Or

go to u_business_unit table and set display check checkbox fro name column.

 

Thanks 

Hi Upender, thanks for your assistance. I would like to avoid making dictionary level changes in the custom tables. Is there any other way to achieve the requirement, preferably via catalog client script

Hi,

I have searched but not found any other solution.

Please share if you found solution other then setting display column.

 

Thanks