function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc550sfdc550 

Account table shows related contacts using + symbol

My requirement is i want to have an account table with + symbol. If i click on the + symbol it must expand and it must show related contacts in same table without reloading the page??

Can anyone please help me how to achieve this functionality in vf page??
Neetu_BansalNeetu_Bansal
Hi,

There are several ways to achieve this. I am specifying one:

1. Create a visualforce page and its controller class.
2, Just query the account and display on the page with a image of +.
3. When you click on the image, call an action function, which will get all the contacta of accounts and render a section on vf page to show the contacts.

Thanks,
Neetu
Amit Chaudhary 8Amit Chaudhary 8
HI,

Please try below code. I hope that will help you
<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!accounts}" var="a" >
                <apex:pageBlockSection title="{!a.name}" columns="1">
                      <apex:relatedList list="Contacts" subject="{!a.Id}"/>
                </apex:pageBlockSection>
            </apex:repeat>      
         </apex:pageBlock>
</apex:page>
Please let us know if this will help you.

Thanks
AMit Chaudhary