Default value for reference field not showing up

yundlu316
Kilo Guru

We have a custom table with a reference field to sys_user and we want the default value to be the current user.  Under the Default Value tab, we put in javascript:gs.getUserID().  When we go back to the form, we can see that a value is in there as indicated by the "i" button next to the field, but the field is empty:

find_real_file.png

How do we get the current user to populate in the actual field?

6 REPLIES 6

VIVEK ANAND
Mega Guru

Hi yundlu316,

Issue could be with the display field set up of sys_user table. Please follow the below steps,

  1. go to list view of sys_user table
  2. right click from header and choose Configure > table
  3. check which field has display column set to true
  4. if you see no fields, set display column as true for name field
  5. save it.
  6. refresh the form and check now.

Thanks,
Vivek Anand

Please Note: If my response helps you to fix this issue, please mark it as correct!

 

Rajshekhar Pau1
Kilo Guru

Hi,

Or, try using 

javascript:gs.getUserName();

instead of gs.getUserID();

Also, you can make use of:

find_real_file.png

Hope this helps.

Mark helpful or correct based on impact.

 

Thanks.

pramodkumar
Tera Expert

Hello yundlu316,

 

In the default value tab, check the dynamic default box and create a new dynamic default value, give a label and in the script field please enter this value gs.getUserID(); . 

Also make sure to check the display value on sys_user table.

 

 

 

 

Thanks!

Saurav Maiti
Mega Expert

In the default value tab, check the dynamic default box and create a new dynamic default value, give a label and in the script field please enter this value gs.getUserID(); . 

 

If my answer helped you in any way, please then mark it as helpful/Correct