+ Start a Discussion
Rohit RadhakrishnanRohit Radhakrishnan 

Relationship Query on Exernal Object

What exactly does the statement mean? - Each SOQL query can have up to 4 joins across external objects and other types of objects.
I have 2 (A__x and B__x) external objects that are related to each other and one is a parent to a Case object.
Case has the External Lookup field a__c that has lookup to A__x
A__x has indirect lookup field b__c that has lookup to B__x
When I do {SELECT CaseNumber, a__c, A__r.b__c, a__r.b__r.Id FROM Case], i dont get the details from a__r.b__r.Id. However a callout id iniated as per the logs. Is this a limitation?
Suraj Tripathi 47Suraj Tripathi 47

Hi Rohit,

I think you made a mistake in your query which is I think you skipped the A__x custom relation at place a__r.b__r.Id. As you are directly trying to get the b__r from a__r. However, the approach should be like a__r.A__r.b__r.Id. So the overall query will be:

[SELECT CaseNumber, a__c, A__r.b__c, a__r.A__r.b__r.Id FROM Case];

Kindly try this way hope you'll get the result. If still not then feel free to discuss.


If you found this solution helpful, then feel free to mark it as the best answer to help others too.

Thanks and Regards,