Soql to query parent fields inside of a child query which is a parent – child query

soql

I am trying to retrieve the parent fields of a child object which is already inside of a parent to child query. I do understand that the retrieving polymorphic fields dont work on joins based on this post Child to parent SOQL query inside a parent to child query.

In my case I am not pulling any polymorphic fields just the custom fields of the custom object. I am not getting any errors on the query, so I believe I am using the right relationship names to access the fields.

Here is the query –

SELECT Id, CaseNumber,(SELECT Equipment__c, Equipment__r.Name, Equipment__r.Maintenance_Cycle__c FROM Equipment_Maintenance_Items__r) FROM Case where CaseNumber ='00001026'

Here is the result of the query for which I am getting Object Object for the Equipment__r.Name & Equipment__r.Maintenance_Cycle__c fields –

enter image description here

Best Answer

The data is being returned, but the Developer Console's Query tab doesn't support grandparent (or higher) parent relationships, or relationships from child objects. Try using the Workbench instead.

Related Topic