You need to sign in to do that
Don't have an account?

How to show related contacts
Hello friends
I have a requirement where I need to display under each account name its related contacts & opportunities in a single visual force page.
like as follows:
Accname:AxisBank
contact1:
oppor1:
Kindly let me know.
regards
sonali verma
I have a requirement where I need to display under each account name its related contacts & opportunities in a single visual force page.
like as follows:
Accname:AxisBank
contact1:
oppor1:
Kindly let me know.
regards
sonali verma
@amit you can use setController for this purpose.
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
http://sfdcsrini.blogspot.com/2014/06/view-all-account-related-contacts-in.html
Please mark this as solution if this will help you
@amit you can use setController for this purpose.
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!
<apex:detail subject="{!'00128000003FuHb'}" relatedlist="true" />
replace the above number subject value with your record id. U can use how many as u want.
example:-
<apex:detail subject="{!'00128000003FuHb'}" relatedlist="true" />
<apex:detail subject="{!'008723987003FuHb'}" relatedlist="true" />
<apex:detail subject="{!'001223723603FuHb'}" relatedlist="true" />
Note:- standardcontroller="account" is not mandatory, its u r choice in this program.
please like this post if it useful to u.
your code will display all details page of Account with All related list which will not fit with requirement.
Please mark as best answer so it will help to other who will serve same problem.
Thanks!
The code what you sent fits my requirement. Thanks
regards
sonali verma