Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count number of child object records in Salesforce

Hi. In Salesforce CRM is kind of difficult to have field on parent object record summarizing child object records like Count, Sum, Max, Min, etc unless you use Master-detail relationship, which comes with other limitations so it cannot be always used. I was thinking I could use Talend to calculate this instead and inject the values into parent object record. On Account-Contact example I wanted to use following query (talking about Count now)

"SELECT AccountId,count(Id) FROM Contact GROUP BY AccountId"

which would give me the Contact count that I could inject into the Account record. However this fails because of "Aggregate query does not support queryMore()".

I dont know how to go around this, can someone help me or Im open to take completely different approach if you have idea and it leads to what I need. Thank you very much

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II

As aggregate relationships are not supported in salesforce Bulk Query (which is a way to avoid any call to the queryMore() method), I'm afraid you have to query all Contact records (based on your example) to get Id and AccountId fields and use the tAggregateRow component to compute the number of Contact for each Account.

View solution in original post

2 Replies
TRF
Champion II

As aggregate relationships are not supported in salesforce Bulk Query (which is a way to avoid any call to the queryMore() method), I'm afraid you have to query all Contact records (based on your example) to get Id and AccountId fields and use the tAggregateRow component to compute the number of Contact for each Account.

TRF
Champion II

@Lukas, does this help?

If so, thanks to mark your case as solved (Kudos also accepted as a bonus)