I am attempting to create a visualforce table section on the Account object. The Card Spend object is a child via master-detail to the Account object.
I keep getting "Error: Invalid field Card_Spend__c for SObject Account".
Why can I not reference the child object and its fields?
<apex:page standardController="Account">
<apex:pageBlock title="Card Spend title">
</apex:pageBlock>
<apex:pageBlock title="Card Spend">
<apex:pageBlockTable value="{!Account.Card_Spend__c}" var="Card Spend">
<apex:column value="{!Card_Spend__c.Company_Credit_Limit__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
As always thank you for your help gentlemen.
Best Answer
If the Card_Spend__c is a child object then you need to refer by its child relationship name which you can find by opening detail page of field which you have created as a master detail on Card Spend object.
Please check snapshot to get idea about where you can find child relationship name. Make sure that you append __r after that name whenever you want to use it in apex/visualforce.
Then your final code would be as below :