How do I get currently Logged in User's email address in Work Flow?

Rajanmehta
Mega Guru

Hello,

I have a very simple work flow in which I have to use currently logged in user's email address. How can I get this?

Thanks,

1 ACCEPTED SOLUTION

snehabinani26
Tera Guru

Hi Raj,



var myUserObject = gs.getUser();


myUserObject.getEmail() -- returns the email address of the current user


View solution in original post

9 REPLIES 9

Thank you Ganesh.



Right on dot. Your answer is also correct.


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rajankumar,



Following script can be used:


var loggedInUserEmail = gs.getUser().getEmail();



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

Thank you Ankur,



Right on dot. Your answer is also correct.


Hi Rajankumar 

you can write before Business rule for getting current user EmailID

(function executeRule(current, previous /*null when async*/) {
gs.addInfoMessage('test');

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

})(current, previous);

 

mark helpful/correct if it is helpful

Thank you

Vijay Kumar S

Vijay kumar S1
Tera Expert

Hi Rajankumar 

you can write before Business rule for getting current user EmailID

(function executeRule(current, previous /*null when async*/) {
gs.addInfoMessage('test');

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

})(current, previous);

 

mark helpful/correct if it is helpful

Thank you

Vijay Kumar S