I'm diving into visualforce and the standard controller for the first time and having trouble iterating over a single opportunity's related records. The below code produces an error:
<apex:page standardController="Opportunity">
<apex:pageBlock title="{!Opportunity.name}">
<apex:pageBlockSection title="{!Opportunity.Id}">
<apex:repeat value="{!Opportunity.Custom_object__c}" var="c">
<apex:pageBlockSectionItem>
{!c.Name}
</apex:pageBlockSectionItem>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock></apex:page>
The error I'm receiving is as follows:
Error: Unknown property 'String.Name'
I take from this that the Visualforce is not interpreting the {!c.Name}
as the array of objects I thought it was but instead as a string. I am able to save the file when I remove {!c.Name}
which makes me think that is correct but, on the other hand, when substituting value="{!Opportunity.Account}"
the code correctly retrieves the related Account. My instinct is that I'm not referencing the related child-objects correctly. I've been banging my head for a bit of time and was wondering if someone could provide some insight as to what is going on?