+ Start a Discussion
Howard WeinsteinHoward Weinstein 

Trying to Display a related List for 2 Custom Objects

I took from trailhead the simple example of taking the accounts object and showing the related contacts in a form.

I used two custom objects in my org

We have Employees (SFDC_Employee__c) and we have Reviews (SFDC_SkillsDev_Review__c)

All I am trying to do is have a form that brings up the employee with their related reviews

However I am getting an error each time I try to  reference the Id of the reviews in line 27 which is related to lines 22 to 35

Code Below
<apex:page standardController="SFDC_Employee__c">
    <apex:pageBlock title="Edit Employee">

            <apex:inputField value="{! SFDC_Employee__c.Name }"/>    
            <apex:pageBlockSection columns="1">
    <apex:inputField value="{! SFDC_Employee__c.Name }"/>
    <apex:inputField value="{! SFDC_Employee__c.Job_Function__c }"/>        
    <apex:inputField value="{! SFDC_Employee__c.Start_Date__c }"/>        
    <apex:inputField value="{! SFDC_Employee__c.Email_Address__c }"/>

            <apex:commandButton action="{! save }" value="Save" />        

        <apex:pageBlock title="Reviews">
    <apex:pageBlockTable value="{!SFDC_Employee__c.Reviews__c}" var="review">
                value="{! URLFOR($Action.SFDC_SkillsDev_Review__c.Edit, review.Id) }">
        <apex:column value="{!review.Name}"/>
        <apex:column value="{!review.Period_Review__c}"/>
        <apex:column value="{!review.Review_Type__c}"/>
</apex:page>User-added image
Best Answer chosen by Howard Weinstein
Big EarsBig Ears
So, on line 24, try:
<apex:pageblocktable value="{!SFDC_Employee__c.Revews__r}" var="review">


All Answers

Big EarsBig Ears

You may have wrongly identified the variable for the child reviews object. I would expect it to be something like "Reviews__r" rather than "Reviews__c"

Big EarsBig Ears
So, on line 24, try:
<apex:pageblocktable value="{!SFDC_Employee__c.Revews__r}" var="review">

This was selected as the best answer
Amit Chaudhary 8Amit Chaudhary 8
Try to modify your code like below code. I hope that will help u
<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!accounts}" var="a">
<apex:pageBlockSection title="{!a.name}"></apex:pageBlockSection>
  <apex:relatedList list="Contacts" subject="{!a.Id}"/>
<apex:relatedList list="Opportunities" subject="{!a.Id}" />