You need to sign in to do that
Don't have an account?
kickingboy
Displaying related list data
Hi
I have 2 custom objects Service and Service Event which have a master-detail relationship. Child relationship name is ServiceEvents.
When I try to save the following code I get the error message: Error: Invalid field ServiceEvents for SObject Service__c
<apex:page standardController="Service__c">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying Schedules from the {!service__c.name} Service record.
</apex:pageBlock>
<apex:pageBlock title="Schedules">
<apex:dataTable value="{!service__c.ServiceEvents}" var="a" cellPadding="4" border="1">
<apex:column>
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:page>
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying Schedules from the {!service__c.name} Service record.
</apex:pageBlock>
<apex:pageBlock title="Schedules">
<apex:dataTable value="{!service__c.ServiceEvents}" var="a" cellPadding="4" border="1">
<apex:column>
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:page>
This seems functionally identical to the following code which works perfectly (it should its out of the VF manual). What am I not understanding?
<apex:page standardController="Account">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are viewing the {!account.name} account.
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!account.Contacts}" var="contact">
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are viewing the {!account.name} account.
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!account.Contacts}" var="contact">
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
So, would a pageblocktable work for your needs? If so, you should be set, if not, you will proabably need to implement a custom controller to extract the related list and reference it separately.
I eventually managed to install Apex Explorer - as you suggested - which required the .Net framework (68MB download) and which itself required the 3.1 windows installer. The Explorer showed the name of the child realtionship name was ServiceEvents__r so when I added the __r suffix it worked but I did use a pageBlock
Stuart