+ Start a Discussion
Chris MacomberChris Macomber 

How to reference the user being viewed (not the global logged in user)

I'm building a VisualForce page for a custom profile tab, and I need to retrieve the email address of the user being viewed (not the logged in user).  I'm hoping to avoid creating a custom controller and was trying to find a merge field that would retrieve the email address of the user being viewed.  Unfortunately {!user.email} just returns an empty string.  Is there a field I can use or do I have to create a custom controller?
Terence_ChiuTerence_Chiu
Are you setting the standardcontroller attribute to the User object and are you passing the id value as a query string parameter in the url? The below should work if you pass the user record Id, for instance na<X>.salesforce.com/apex/<VFPAGE>?Id=<User Id>

<apex:page standardController="User">

    {!User.Email}
</apex:page>