You need to sign in to do that
Don't have an account?
Howard 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:form>
<apex:pageBlock title="Edit Employee">
<apex:pageMessages/>
<apex:pageBlockSection>
<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:pageBlockSection>
</apex:pageBlockSection>
<apex:pageBlockButtons>
<apex:commandButton action="{! save }" value="Save" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Reviews">
<apex:pageBlockTable value="{!SFDC_Employee__c.Reviews__c}" var="review">
<apex:column>
<apex:outputLink
value="{! URLFOR($Action.SFDC_SkillsDev_Review__c.Edit, review.Id) }">
Edit
</apex:outputLink>
</apex:column>
<apex:column value="{!review.Name}"/>
<apex:column value="{!review.Period_Review__c}"/>
<apex:column value="{!review.Review_Type__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
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:form>
<apex:pageBlock title="Edit Employee">
<apex:pageMessages/>
<apex:pageBlockSection>
<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:pageBlockSection>
</apex:pageBlockSection>
<apex:pageBlockButtons>
<apex:commandButton action="{! save }" value="Save" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Reviews">
<apex:pageBlockTable value="{!SFDC_Employee__c.Reviews__c}" var="review">
<apex:column>
<apex:outputLink
value="{! URLFOR($Action.SFDC_SkillsDev_Review__c.Edit, review.Id) }">
Edit
</apex:outputLink>
</apex:column>
<apex:column value="{!review.Name}"/>
<apex:column value="{!review.Period_Review__c}"/>
<apex:column value="{!review.Review_Type__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
All Answers
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"
Andy