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
nagalakshminagalakshmi 

How to display the related contacts of an account

Hi,

 

Actually I am displaying the accounts one page block table on visual force page and i keep the command link for account name. If i click on that command link it will display the related contacts in another page block of same visual force page.

 

 

Now My requirement is, i want to display the contacts after the account name if i click on the account name. It is not mandotary to use the pageblock. How can i display the contacts after the account name if i click on the account name.  Any one please help me how to solve this.

 

Thanks,

 

Lakshmi

 

 

dev401hasdev401has

Hey it can be done in simple way. You have kept the command link for account name so also use Apex:Param in command link and set the value of that account in one setter.

 

Use that account ID and query in contacts. Fetch all the contacts in a list and return the list in a getter method. Use that getter method in pageblocktable and display the contacts.

 

You can render the contacts pageblockTable using rendered attribute. When contacts are present then only it will display or else wont.

nagalakshminagalakshmi

Hi,

 

Thanks for the reply..

My requirement is"

 

account1

account2

account3

.

.

 

suppose i click on account 1 it has to display related contact details of that account like this:

 

 

 

account1

    contact1

    contact2

account2

account3

account4

.

.

.it should be like this.

 

Can u help me?

please...

SayasoniSayasoni

 

Any luck on this? I have the same requirement.