You need to sign in to do that
Don't have an account?
Mike @ BlackTab
Access $User.Email From Apex Controller
Hello,
I'm trying to access the $User.email global variable from within an Apex class. Is this possible? I just need to get the running user's email address.
A quick response will be very helpful,
Thanks
Hi,
I don’t think that you can use global variable inside the controller. So you have to make the query on User to get the email id of that user or you can pass the value of email using global variable inside the controller by using apex:param tag from vf page.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi,
You can use this, eg:
UserInfo.getUserName();
Or query like this: [SELECT Email FROM User WHERE Id=:UserInfo.getUserId()];