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
RajeevlsHydRajeevlsHyd 

Populate value on a VF page

I want to populate Manager's Name for the user selected in a lookup field in VF page ..

When user select EmpName -  Lookup field to user on VF apge,

I want to populate its corresponding manager's name..

 

Kindly suggest

 

 

VF page :

 

<apex:column headerValue="QC/DM Name">
<apex:inputField value="{!obj.dsObj.EmpName}" rendered="{!NOT(obj.isSummaryRecord) && NOT(obj.isFirstRecord)}"/>
<apex:outputLabel value="" style="text-align:right; font-weight: bold;" rendered="{!obj.isSummaryRecord}"/>
<apex:OutputField value="{!obj.dsObj.EmpName}" rendered="{!NOT(obj.isSummaryRecord)&& (obj.isFirstRecord)}"/>
<apex:actionsupport event="onchange" action="{!SelectManager}" rerender="!obj.isSummaryRecord, mgrName" status="waitingStatus"/>
<apex:param name="UsrId" value="{!obj.dsObj.EmpName}" assignTo="{!UsrId}"/>
</apex:column>

 

<apex:column headerValue="Manager Name" id="mgrName">
<apex:OutputField value="{!obj.dsObj.Manager__c}" rendered="{!NOT(obj.isSummaryRecord)}"/>
</apex:column>

 

 

Controller Class :

 

public PageReference SelectManager()
{
String UsrId;
String UsrName ;
User usr = [Select Id, Name , Reports_To__c from User where IsActive = true and Id =: UsrId Limit 1];
UsrName = usr.Reports_To__c ;
return Null;
}