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
Deepika Gupta 26Deepika Gupta 26 

Account & Contact Hierarchy

Hi All,
I have a Requirement that i have to show account hierarchy in a VF page and its corresponding contacts in a hierarchy form like Accounts->Account1->Contact1,Contact2
Account2->Contact1,Contact2 like Role hierrachy means in a tree form but not finding exact solution that how can i get tree strcuture in a VF page of Accounts and Contacts.Could any one help me on this?
Himanshu Jasuja 9Himanshu Jasuja 9
Hi deepika,
 there is no native way of doing in visualforce. Have to do with external tools. Two ways i know of
1. Using Jquery
2. Using Flex
Hi Deepika,

Just explore the below mentioned Jquery to achieve this functionality:

If you do not want to achieve this through Jquery, then use below mentioned code:
<apex:repeat value="{!accounts}" var="obj">
<apex:repeat value="{!obj.Contacts}" var="objCon">
<div style="padding-left:30px;margin-top:5px;">

Just modify the code as per your need. You might need to adjust the CSS a little to achieve this desired look.