I want to be able to perform a FetchXML request that sums a value while grouping on a field that is a custom option set but I don't get the expected results.
All that is returned is the summed up values, not the related custom option set value that it relates to so I have no idea what the returned values relate to.
This is the fetchXML request which appears to be correct:
<fetch distinct='false' mapping='logical' aggregate='true'>
<entity name='opportunity'>
<attribute name='estimatedvalue' alias='opportunity_sum' aggregate='sum' />
<attribute name='koo_opportunitytype' alias='koo_opportunitytype' groupby='true' />
</entity>
</fetch>
Each value that is returned only has 1 attribute...the opportunity_sum value.
If I group by say, customer id, then the returned values are summed up correctly and a reference is returned to the related customer for each summed value which is what I would expect.
Is it not possible to group by a custom option set value? This seems to work fine with standard system option set values such as status code.