Ask Your Question
0

Multiple sub-queries to pull data from different children objects in Salesforce Is stored in different records

asked 2019-12-30 17:25:04 -0500

tclaw46 gravatar image

I am trying to write an SOQL query that uses a parent object to pull data from two of its child objects. I am trying to use two sub_queries to pull data from each of the child objects. Here is an example of what my query is so far:

"select Id,Employee_ID__c,(select Id, Employee_ID__c, FF__Roster_Name__c from FF__Roster_Members__r), (select Id,Employee_ID__c , FF__Team_Name__c from FF__Team_Members__r) from FF__Key_Contact__c where RecordTypeId = '<id>' and Department__c = False"

The query does work and pull the data I want, but for some reason, the data from the second sub_query is getting split into different records.

image description

The data in Record2 and Record3 should be another List in Record1 instead of their own records. Is there a way I can modify the soql query so it doesn't split them up like this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-12-31 10:42:04 -0500

tclaw46 gravatar image

Found the solution. I switched from bulk API to SOAP API and that fixed the issue. It isn't as fast as bulk API, but it gets the job done.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-12-30 17:25:04 -0500

Seen: 42 times

Last updated: Dec 31 '19