1

I 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:pageBlockButtons>
 <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>
  <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}"/>  
 </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

enter image description here

could some one help me to display the lookup field of parent on child record

  • Have you confirmed that Field Level Security is set properly for the Employee field? – Jeremy Nottingham Sep 14 '14 at 15:04
1

That's a bit strange... can you confirm the user you are testing this on has the ability to view the parent Sobject / record? Also there's a sharing setting on the field which is the master detail relationship, ie: Employee__c is set properly. If they are allowed to see the parent record but no modify it you'll have to change the sharing setting to read only.

Lastly, master-detail relationships are always required so there's no way its read only. If this is a standard lookup, make sure it's not limiting your user that you are testing as to only see it as read only.

  • employee__C has all the permissions to view for all the users. there is no restriction for it – Salesforce developer Jul 15 '14 at 18:20
  • This is the field looking up to the parent, but what about the parent object itself? Is it deployed, does the user you are testing as have access to the parent table? – Double A Jul 15 '14 at 19:21
  • 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 – Salesforce developer Jul 17 '14 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.