Notifications
Announcements
No record found.
I need to fetch child entities along with the SUM of a field 'amount' from all child records (of a particular parent record). For E.g. If there are 3 child records for a parent record, so need to have SUM of all 3 different amount values of each child record. Also, the SUM needs to be calculated for the child records where it meets certain criteria. I already tried adding aggregate along with filter condition (so that my aggregate would be applicable on filtered records only), but it did not work. Please suggest.
TIA.
This should be possible. Can you post the fetchXml that you have so far, and an example of the results ?
Hi,
So I've made an example on my own, with the following fetchxml:
And I think this is you scenario. I have an Account that has a 1:N relationship with Lead entity. So I've done a fetch that makes the sum of the "estimatedamount" field on every lead related to that Account. My result was the following:
<resultset morerecords="0"><result><name>Joana Pinto</name><amount formattedvalue="€4,654.01">4654.01</amount></result></resultset>
You have to put on the beginning the aggregate="true" and then put the aggregate="sum" on the field you want to sum.
Regards,
Joana
I have a scenario where I have to retrieve data from child entity using fetchxml. Example: I have few child records having an attribute 'Role' with values RoleA, RoleB, RoleC (which is an Optionset) and another attribute as Amount(textfield). I want to get sum of amount for those records having value 'RoleB'. Please help me with the filter condition.
You just need to add the filter condition that you want on the link entity. In my case, my related record is Lead records and I put a condition saying that I only want the sum of Leads that are Open (status field). Like this (line 10):
If you still have doubts please, provide your fetchxml so we can help you.
Thanks.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 83 Super User 2025 Season 2
Gerardo RenterÃa Ga... 49 Most Valuable Professional
#ManoVerse 40