How can I set Dynamic default value for a reference field?

demet1
Giga Contributor

Hi, 

I am creating a new app and it has a table that contains a reference field. The reference field's name is 'Assigned to' and it uses 'sys_user' table. I need to set 'dynamic default value'. Its label 'Sender' and its script is 'gs.getUserID();' 

However it is not working and give me the error 'Invalid default value'. How can I solve this problem?find_real_file.png

Thanks for advance.find_real_file.png

8 REPLIES 8

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Do need to set the value of the logged in user on the filed ?

If so, then set the 'default value' on the dictionary as 'javascript:gs.getUserID()'. 

PS, uncheck the 'dynamic default', and just add the 'default value'.

-Anurag

-Anurag

Hi, 

I did what you said but I got the same error.

Thanks.

Can you show a screenshot of the dictionary with error?

-Anurag

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Is this happening with admin or non-admins.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader