0

I just wonder if this is possible and cannot find anything online about it, so imagine the following scenario:

Let's say we have a parent object named Parent__c and it has 2 related lists of objects: Child1__c and Child2__c

Both are lookup relationships from Child to Parent

Child1__c has a number of it's own related lists, and we're trying to query all the data from those, but it would be nice to have the related list of the second Child object as well.

I understand double nested queries aren't supported, and obtaining all of this info through Parent object should be impossible.

So would it be possible to obtain this in a single query on the Child1__c object? I.E. can we somehow query Parent__c's Child2__c related list through its Child1__c relationship?

1

1 Answer 1

1

Two queries would be needed to achieve this One to get the parent details from Child1__c and the other to get Child2__c record with the same parent record

To get records from more than one unrelated objects, we can use SOSL and even SOSL can't work for fetching record details via Lookup fields For reference - https://help.salesforce.com/s/articleView?id=000328676&type=1

3
  • Yeah that would be one way to achieve this, but I'm specifically asking if it's possible to achieve it through one child query. I believe it isn't, but I cannot find anything in the documentation that would undeniably confirm this, and I also cannot find anyone inquiring on the subject. Commented Sep 8, 2022 at 10:55
  • 1
    Specifically with a single query - I regret, no, not possible No documentation to support this , yeah, but there's no documentation to prove single query possibility on this case, too. In case if SF make it possible by anyway in future releases or so, it'd be great though Updated the answer with SOSL consideration for your kind reference.
    – JPM
    Commented Sep 9, 2022 at 9:16
  • 1
    Thank you, I've thought as much but wanted to check if anyone had more insight on this! Commented Sep 9, 2022 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .