Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to write the default value to set the field's default value as current user's email?

chenyanwei
Giga Contributor
1 ACCEPTED SOLUTION

Shweta KHAJAPUR
Tera Guru

Hi chenyanwei,

You can write 

javascript: gs.getUser().email;

 

View solution in original post

6 REPLIES 6

snehabinani26
Tera Guru

You can write javascript: gs.getUser().getEmail();

 

For more details refer page https://docs.servicenow.com/bundle/jakarta-application-development/page/script/server-scripting/task/t_GetAUserObject.html?title=Getting_a_User_Object#gsc.tab=0.

 

Hope this helps

Harsh Vardhan
Giga Patron

try now

in default value paste the below code.

javascript: gs.getUser().getRecord().getValue('email');

 

Thanks,

Harshvardhan

 

Thank youuuuuu

Shweta KHAJAPUR
Tera Guru

Hi chenyanwei,

You can write 

javascript: gs.getUser().email;