+ Start a Discussion
krishna casukhela 7krishna casukhela 7 

Show related contacts & Opportunities for each account in a single page

Hi friends
I admit I am novice to VF. 

For every account name I need to display related contacts & opportunities like this in a single visual force page.

UserName: krishna
---------------------------
accname: AxisBak
contact1:
contact2:
oppor1:
oppor2

accname:Airtel
Contact2:
contact3

Please let me know how this is achieved

Regards
krishna casukhela
P
Best Answer chosen by krishna casukhela 7
Shrikant BagalShrikant Bagal
Hello Krishna,

Please try
--------------------------------------------------------------------------------------------------------------------------

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!accounts}" var="a">
<apex:pageBlockSection title="{!a.name}"></apex:pageBlockSection>
  <apex:relatedList list="Contacts" subject="{!a.Id}"/>
<apex:relatedList list="Opportunities" subject="{!a.Id}" />
</apex:repeat>      
     </apex:pageBlock>
</apex:page>

--------------------------------------------------------------------------------------------------------------------------------

​Please mark as best answer so it will help to other who will serve same problem.
​Thanks! 




 

All Answers

Shrikant BagalShrikant Bagal
Hello Krishna,

Please try
--------------------------------------------------------------------------------------------------------------------------

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!accounts}" var="a">
<apex:pageBlockSection title="{!a.name}"></apex:pageBlockSection>
  <apex:relatedList list="Contacts" subject="{!a.Id}"/>
<apex:relatedList list="Opportunities" subject="{!a.Id}" />
</apex:repeat>      
     </apex:pageBlock>
</apex:page>

--------------------------------------------------------------------------------------------------------------------------------

​Please mark as best answer so it will help to other who will serve same problem.
​Thanks! 




 
This was selected as the best answer
Shrikant BagalShrikant Bagal
Hello krishna,
Please mark as best answer so it will help to other who will serve same problem.
​Thanks! 
krishna casukhela 7krishna casukhela 7
Hello Shrikanth
Many thanks for ur reply. gr8 man. I was looking exactly for this functionality wherein I can edit & add.

Regards
krishna
Shrikant BagalShrikant Bagal
np Krishna, Keep Sharing...... :)