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
deux4everdeux4ever 

How do I display a child's related list in the parent record's layout using Visualforce?

I have a 3 level relationship (parent -> child -> child's_child) object and I want to be able to display a child's_child related list from the parent record. I figure VF would be the best approach for this, but how do I traverse down into the child's_child record from the parent? Any help would be appreciated.
Edwin VijayEdwin Vijay
Nested SOQL queries should help you achieve the result. Here is a sample code. Hope that helps!

http://www.forcetree.com/2010/04/nested-tables-and-nested-queries-in.html (http://www.forcetree.com/2010/04/nested-tables-and-nested-queries-in.html" target="_blank)
deux4everdeux4ever
I guess I am confused on the syntax of what goes where.The parent is an Account, the child is a custom object (CO1) and the child's child is another custom object (CO2). Account and CO1 are in a master-detail relationship and CO1 and CO2 are in a master-detail relationship. I am trying to return all related records from CO2 that have all the same Account record.
Edwin VijayEdwin Vijay
Select Id,(Select Id, (Select Id,Name from C02), Name From CO1), Name, BillingCountry from Account
Try this approach