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
nitendra nath shuklanitendra nath shukla 

How do I show below relationship in Visualforce Page using custom controller or extensions?

 I have 3 objects account, contact and cases. Account is related to contact and contact is related to cases..How to show all in one vf page?


Could you explain more about your problem statement/requirements?

Do you want to show all Contacts for a particular Account and all the Contact-related Cases on one page? 


Abdul KhatriAbdul Khatri
One quick way to achieve with minimal code and without custom or extension controller is this
<apex:page standardController="Account" >

    <apex:detail relatedList="false" title="true"/>

    <apex:relatedList subject="{!account}" list="contacts" />

    <apex:relatedList subject="{!account}" list="cases" />


SFDC RohitSFDC Rohit
Try below link for displaying mutiple objects records in VF page:-
nitendra nath shuklanitendra nath shukla
Hi @sidhant... you are correct i need to show show all Contacts for a particular Account and all the Contact-related Cases on one page?
Abdul KhatriAbdul Khatri
So my solution doesn't seem like will work for.

In my solution it will show all Contacts for a particular account you will navigate to. Since Cases are tied with Account and Contact. It will also show you all the Cases tied with those Contacts. Here is the screen shot

User-added image
Abdul KhatriAbdul Khatri
You can also achieve the same on the standard Account Layout by adding the Contact and Cases Related List. 
Abdul KhatriAbdul Khatri
Man you haven't provide any feedback?