+ Start a Discussion
sai tarunsai tarun 

I want to diaplay my vf page like ​Account name1 and its child contacts and opportunities, Account name2 and its child contacts and opportunitis.... like below.....

I want to diaplay my vf page like
​Account name1 and its child contacts and opportunities,
Account name2 and its child contacts and opportunitis....
like below.....

Account name1:
Contacts:
        1. xxxxxxxxxxx
        2.xxxxxxxxxxxx
Opportunities:
        1.xxxxxxxxxxxx
        2.xxxxxxxxxxxx

Account name2:
Contacts:
        1. xxxxxxxxxxx
        2.xxxxxxxxxxxx
        3.xxxxxxxxxxxx
Opportunities:
        1.xxxxxxxxxxxx
​        2.xxxxxxxxxxxx
.
.
.
..
adn so on......
How to achive this........
please some one help me..
Thanks in Advance...........
Best Answer chosen by sai tarun
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Sai Tarun,


See child opportunities and contacts under the parent account.May I suggest you please refer the below link to reference. hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar

All Answers

RamakantRamakant
Hi Sai,

Please find below code for the Same:
<apex:page standardController="Account">
  
      <h1>Account : </h1>{!Account.Name}
      
      <apex:pageBlock title="Contacts">
        <apex:pageBlockTable value="{!Account.Contacts}" var="con" columns="2" title="Contacts" headerClass="Contacts">
          <apex:column value="{!con.FirstName}"/>
          <apex:column value="{!con.LastName}"/>
      </apex:pageBlockTable>
      </apex:pageBlock>
      
      <apex:pageBlock title="Opportunities">
        <apex:pageBlockTable value="{!Account.Opportunities}" var="opp" columns="2" title="Opportunities" headerClass="Opportunities">
          <apex:column value="{!opp.Name}"/>
          <apex:column value="{!opp.StageName}"/>
      </apex:pageBlockTable>
      </apex:pageBlock>
      
</apex:page>

Please mark as a best answer if helped.

Regards,
Ramakant​
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Sai Tarun,


See child opportunities and contacts under the parent account.May I suggest you please refer the below link to reference. hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
This was selected as the best answer