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
jessie gracejessie grace 

how to relate child records in salesforce using apex and vf..

I created wrapper class to relate 15 child records of the same object(ex:Territory__c has parent_Territory__c(lookup field of Territory__c))
There is a limitation in salesforce that we cant query more than 5 relationships.
If anyone has any idea to query 15 related child records please help me....!!

Thanks,
Jessy.
Arun_KharbArun_Kharb
Hi Jessie,

Try this query:
Select Id from Territory__c where parent_Territory__c = 'ID_OF_PARENT_RECORD'


Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help.
jessie gracejessie grace
Thanku for the reply Arun:)
I tried the query u mentioned...but its not working for the tree view concept...i want all parent and child records in tree view..
like this..
User-added image

i need all child records in tree view....

Hope you got my requirement!!