• Jasmeen Kaur 15
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi
 
I am trying to build a table of data in a page to show the list of policies details from the Account. Policy__c is the Custom Object.
However, it always show "Invalid field Policy__c for SObject Account.

I did try to modify <apex:pageBlockTable value="{! Account.Policy__c}" var="Policy"> to <apex:pageBlockTable value="{! Account.Policy__r}" var="Policy">, it doesn't work. the error message became  "Invalid field Policy__r for SObject Account.

How can I access the Custom Object from Standard Object? Thanks.
 .
 
<apex:page sidebar="false" standardController="Account">
    
    <apex:pageBlock title="Policy Detials">

   	<apex:pageBlockTable value="{! Account.Policy__c}" var="Policy">
     		 <apex:column value="{! Policy.Insurance_Company__c}"/>
      		<apex:column value="{! Policy.Name}"/>
                <apex:column value="{! Policy.Commencement_Date__c}"/>
 	</apex:pageBlockTable>

    </apex:pageBlock>
</apex:page>