Default Value in Dictionary Entry using Javascript

Katelyn1
Kilo Expert

Hey everyone!

I am trying to create a dictionary entry with a default value to be assigned as the name of the user that is signed in. I found some other questions in the community with this question so i was able to get the code from there, but it is telling me this is an invalid default value. This is what I have so far: 

javascript: current.u_requested_for = gs.getUserDisplayName();

I have the type for this dictionary entry as Reference and it is referring to sys_user. My column label name is Requested For, so respectively my column name is u_requested_for. Is my code wrong for this? Is this even allowed what I am trying to do? Is there a different way to go about doing this? 

 

Thanks!

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi Katelyn,

 

This should be the default value if you want to add the logged in user to a user reference field.

javascript:gs.getUserID();

 

-Anurag

-Anurag

View solution in original post

6 REPLIES 6

Anurag Tripathi
Mega Patron
Mega Patron

Hi Katelyn,

 

This should be the default value if you want to add the logged in user to a user reference field.

javascript:gs.getUserID();

 

-Anurag

-Anurag

Unfortunately it still says that is an invalid default value.

There are many oob fields also using the same:

I just tried, and it is working for me. Are you working in global scope or any other?

 

 

-Anurag

i'm working in the global scope