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
harish garimellaharish garimella 

display a user fiels in visualforce pages

i want to display or retrieve a user fiels in visualforce pages 
  fields which are in customize! users!fields
which may be standard fields or custom fields



Thanks in Advance 
Karan Khanna 6Karan Khanna 6
Hey,

if you intend to display User fields of current logged-in user then use it in this way:

<apex:page>
    Hello {!$User.FirstName}!
</apex:page>


harish garimellaharish garimella
in customize!user!fields


we can create a fields for view for the user profile some extra fields we can create i need to display those fields in visualforce pages

Karan Khanna 6Karan Khanna 6
then you can create an instance of User in your controller like: 
public class MyClass {

	public User myUser;
	public getmyUser() {
		myUser = new User();
	}
	.
	.
	// your code	
}

and refer myUser in your page like:
{!myUser.name}
{!myUser.field1__c}
praveen murugesanpraveen murugesan
Hi,

Contorller code:

public User us{get;set;}

public xxxx()
    {  
        try
        {
         if(this.empDetail.user__c!=null)
         {
          us = [select title,email,department,manager.Name,phone from user where id =: userInfo.getUserID()];
          
         }
        }
        catch(Exception e)
        {
         ApexPages.addMessages(e);
        }

}

Page:

<apex:outputText id="phone"  value="{!us.Phone}" />
<apex:outputText id="email"  value="{!us.email}" />
<apex:outputText id="name"  value="{!us.name}" />
<apex:outputText id="profile"  value="{!us.ProfileId}" />

Hope this answered your question.

Thanks,

Praveen Murugesan
Mahanandeesh BelagantiMahanandeesh Belaganti
thanks