+ Start a Discussion
1111_forcecom1111_forcecom 

How can I display records of the third order

Let me explain. I have an structure where I have three Objects, Contact, Benficio__c, Sayana__c. One Sayana__c have many Contacts, and one Contact have many Beneficios.

 

I try to display all contacts in a sayana__c and in each contact his beneficios. I have the following instructions in visualforce page.

 

<apex:pageBlockTable value="{!ContactosTodos}" var="contact" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
     <apex:column value="{!contact.Name}"/>
     <apex:pageBlockTable value="{!contact.Beneficio__r}" var="beneficio" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
         <apex:column value="{!beneficio.Name}"/>
         <apex:column value="{!beneficio.Catalogo_Beneficio__c}"/>
         <apex:column value="{!beneficio.Moneda__c}"/>
         <apex:column value="{!beneficio.monto_estimado__c}"/>
         <apex:column value="{!beneficio.proposito__c}"/>
     </apex:pageBlockTable>
  </apex:pageBlockTable>

 

For last, let me know where I can see how is the names of relations in salesforce between objects?  I think that will help me so much.

 

Regards,

Best Answer chosen by 1111_forcecom
Yoganand GadekarYoganand Gadekar

You can use relationship Query to fetch child records in apex class and then display in vf page...

All Answers

Yoganand GadekarYoganand Gadekar

You can use relationship Query to fetch child records in apex class and then display in vf page...

This was selected as the best answer
1111_forcecom1111_forcecom

Appreciated with the answer, only I need ask for something:

How can I know what is the names for relations in custom objects for the use in apex class?

1111_forcecom1111_forcecom

This is my code in visualforce page

  <apex:pageBlockTable value="{!Sayana__c.Contacts}" var="contact" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
      <apex:column value="{!contact.Name}"/>
  </apex:pageBlockTable>