Can I also export some fields from the referenced parent sObjects using the child object query?


I have parent object ParentObject__c and want to get all ParentObject__r.Name using the child query on the ChildObject__c. ChildObject__c is the child object and the ParentObject__c is the parent.

I am trying to use this configuration:

SELECT Name, ParentObject__r.Name FROM ChildObject__c


You cant use subqueries and dots in your query. Use only the own object's fields.

In order to extract the names of only those ParentObject__c records, that are related to the ChildObject__c records, use the following queries:

SELECT Name, ParentObject__c FROM ChildObject__c
SELECT Name FROM ParentObject__c

Set master = false for the ParentObject__c object.

Last updated on Sa Oct 2022