function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PegazysPegazys 

How to access Email field from User Object in Visual Force Page

Is it possible to directly access the Email field in the User Object in a Visual Force Page?

 

If we have to get in thru the Controller, is there a standard query for it ?

 

Pls. help

 

Thanks

bob_buzzardbob_buzzard

Assuming you have the User standard controller as the page controller, you should just be able to write:

 

<apex:outputText value="{!User.Email}"/>

 

PegazysPegazys

My Standard Controller is not User. Its a different object

bob_buzzardbob_buzzard

Does your object have a lookup to a User?  I.e. can you reach a user object from it?

PegazysPegazys

No, there is no lookup to User from what I can see.

 

Can we access using something similar to

 

 

string fromEmail = select Email from User u where u.id = :Userinfo.getUserId()].Profile.Name;