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.

Autopopulate logged in user's email

Community Alums
Not applicable

Hi,

I am trying to autopopulate the logged in user's email using business rule. It's not working. Kindly help.

 

1.png

 

2.png

 

3.png

 

(function executeRule(current, previous /*null when async*/ ) {

	current.email = gs.getUser().email;

})(current, previous);

 

Regards

Suman P.

13 REPLIES 13

Anand Kumar P
Giga Patron

Hi @Community Alums ,

 

getEmail() Returns the email address of the currently logged-in user. var email = gs.getUser().getEmail();

 

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand

Community Alums
Not applicable

Hi @Anand Kumar P,

 

It didn't work. it remained the same.

 

Regards

Suman P.

Hi @Community Alums ,

 

Check if loggedin user have valid email.

 

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand

Hi @Community Alums ,

 

for me it’s working as expected 

 

IMG_6685.jpeg

IMG_6686.jpeg

  If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand