+ Start a Discussion
Arunkumar KathirArunkumar Kathir 

Current user mail ID in apex trigger

HI,

 

How to get current user's email ID in apex trigger? Please help.

 

 

Thanks,

Arunkumar

Best Answer chosen by Admin (Salesforce Developers) 
SFDC-SDSFDC-SD

You can use the code below:

User current_user=[SELECT Email FROM User WHERE Id= :UserInfo.getUserId()] ;

 c.Contact_Email__c = current_user.Email;

 

There is no direct method to get User Email unlike UserId

All Answers

SFDC-SDSFDC-SD

You can use the code below:

User current_user=[SELECT Email FROM User WHERE Id= :UserInfo.getUserId()] ;

 c.Contact_Email__c = current_user.Email;

 

There is no direct method to get User Email unlike UserId

This was selected as the best answer
JamuraiJamurai
User this http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_UserInfo_getUserEmail.htm

getUserEmail()