+ Start a Discussion
Sandesh D GanjareSandesh D Ganjare 

Can we display the master detail field?

I have Employee Name field which having master ralationship with standard contact object. I want to display that Employee Name field automatically based on the name of logged in user name in visualforce page.  

help me...!
Balaji BondarBalaji Bondar
Hi Sandesh,

You can use below code and map user field on VF on load of Page:
public class TestClass{
  public user currentuser{get;set;}
  public TestClass(ApexPages.StandardController cont){
     currentuser=new User();
     currentuser=[Select Id,Name,Email from User where Id=:userinfo.getuserId()];

Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.