Display the current logged in User details (Name, Id etc) in Visualforce Page
10:21 AM
Display the current logged in user's details using the global variable $User. An example is given below
<apex:page title="New" standardController="Account">
Hello {!$User.FirstName} {!$User.LastName}
</apex:page>
When you want to do the same in your Apex Class (i.e) get current logged in user information in your Apex Class, use the below method.
public String u {get; set;}
u = Userinfo.getUserId();
To know the list of UserInfo methods supported, check this link http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
Source: http://boards.developerforce.com/t5/Visualforce-Development/Opportunity-Owner-Name-in-Visual-Force-page/td-p/196573
3 comments
How we can fetch the all logged in users for particular account ?PLZ help me
ReplyDeleteis there any option how to getLocale() directly by placeholder $user.{something}
ReplyDeleteYou do have the getLocale() method as documented here http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm. Is this what you were looking for?
Delete