0

I've a requirement for which I need to nested list view in the Related list of An object . It's something like this , suppose a account has 3 contacts . so in Account records related list 3 contacts list will be visible , lets say in contacts are Associated with some cases . So i want to see those cases associated with respective contacts in the related list of Account somegthing like nested list . Is that possible ?

Account A Related List

Contact 1 - Case 1 -Case 2 Contact 2 -Case 3 Contact 3

0

controller:
public class treechilds {

public class cChilds {

public List parent {get; set;} Public Account gparent {get;set;}

public cChilds(Account gp, List p) { parent = p; gparent = gp; } }

Public List hierarchy;

Public List getmainnodes() { hierarchy = new List(); List tempparent = [Select Id,Name from Account]; for (Integer i =0; i< tempparent.size() ; i++) { List tempchildren = [Select Id,FirstName,LastName,(Select Id,CaseNumber,Subject from Cases) from Contact where AccountId = :tempparent[i].Id]; hierarchy.add(new cNodes(tempparent[i],tempchildren)); }
return hierarchy; }
}

apex page : <apex:page sidebar="false" controller="treenodes" showheader="false">

<link rel="stylesheet" href="{!URLFOR($Resource.Jtreeview,'Jquerytreeview/jquery.treeview.css')}"/>
<script src="{!URLFOR($Resource.Jtreeview,'Jquerytreeview/jquery.js')}" type="text/javascript"></script>
<script src="{!URLFOR($Resource.Jtreeview,'Jquerytreeview/jquery.cookie.js')}" type="text/javascript"></script>
<script src="{!URLFOR($Resource.Jtreeview,'Jquerytreeview/jquery.treeview.js')}" type="text/javascript"></script>
$(function() { $("#tree").treeview({ collapsed: false, animated: "medium", control:"#sidetreecontrol", persist: "location" }); })




  Collapse All | Expand All
      • ||  
  • Note: you may have to optimize the apex class to handle more than 100 queries as this exemple has a SOQL query within a FOR loop (An Example of bad programming practice). enter image description here

    2
    • Thanks got it but it will override the complete related list right ? I don't want to do that , I want nested related list view for a particular child record of an object – Salesforcegeek Apr 7 at 15:38
    • yes but i think its not possible wiith standards – Mostafa Agourri Apr 7 at 15:46

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.