Default value in a reference field

ceraulo
Mega Guru

Hello!

I have a custom table containing a field that references the User table. I want this field to have a Default value. Is this possible? I tried inputting the User ID, name, sysID of the User but it does not work.

Please help!

Thanks.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ceraulo 

you need to put the sysId of the user record you want to see as default value

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

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@ceraulo 

you need to put the sysId of the user record you want to see as default value

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

Is this best practice or should I use a System Property?

You can also use a system property use it as follows 

 

javascript:gs.getProperty('some.default.user.sysid');

 

@ceraulo 

not recommended to use hard-coded sysId

1) create a system property of type string and store the sysId there

2) then in default value use this

javascript: gs.getProperty('propertyName');
Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader