+ Start a Discussion
Sandeep M 1Sandeep M 1 

Display parent as lookup field on child in visualforce page

have two objects SFDC_PTO_Request__c (child),Employee__c (parent) with Master-Detail relationship. I need to display parent on child record while inserting on visualforce page which was a lookup relationship. I am trying as below

<apex:page standardController="SFDC_PTO_Request__c" recordSetVar="SFDC_PTO_Request" sidebar="false">
<apex:form >
<apex:pageBlock title="Leave Request Edit">
<apex:pageBlockButtons >
     <apex:commandButton action="{!Save}" value="Save"/>
     <apex:commandButton action="{!Cancel}" value="Cancel"/>
<apex:pageBlockSection title="Information" columns="2" collapsible="false">
      <apex:inputField value="{!SFDC_PTO_Request__c.Type_of_leave__c}"/>
      <apex:inputField value="{!SFDC_PTO_Request__c.Available_Casual_Leaves__c}"/>    
      <apex:inputField value="{!SFDC_PTO_Request__c.Available_Sick_Leaves__c}"/>  
      <apex:inputField value="{!SFDC_PTO_Request__c.Request_Type__c}"/>  
      <apex:inputField value="{!SFDC_PTO_Request__c.Employee__c}"/>
  <apex:pageBlockSection title="Request Dates" columns="2" collapsible="false">
      <apex:inputField value="{!SFDC_PTO_Request__c.Request_Start_Date__c}"/>
      <apex:inputField value="{!SFDC_PTO_Request__c.Request_End_Date__c}"/> 

User-added image

could some one help me to display the lookup field of parent on child record
James LoghryJames Loghry
Looks like this should work the way you have it. Have you checked your profile to make sure you have the write level of security to set the value?  In particular the field needs to be writeable (should already be since it's a master detail relationship), but also check to make sure the parent Employee object is readable as well.
Sandeep M 1Sandeep M 1
Both Employee and Leave Request object were in deployed status.I have Admin permissions of both these objects. 

Read, Create, Edit, Delete, View All, Modify All, View Setup, Edit Setup, Delete Setup all were given