Hi,
I'm trying to retrieve the activity with the minimum scheduled start date as follows:
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' aggregate='true'>
<entity name='activitypointer'>
<attribute name='activitytypecode' groupby='true' alias='activitytypecode_min'/>
<attribute name='scheduledstart' aggregate='min' alias='scheduledstart_min' />
<filter type='and'>
<condition attribute='statecode' operator='in'>
<value>0</value>
<value>3</value>
</condition>
</filter>
<link-entity name='opportunity' from='opportunityid' to='regardingobjectid' alias='ae'>
<filter type='and'>
<condition attribute='opportunityid' operator='eq' uitype='opportunity' value="{E8409D2A-2582-E511-80FD-3863BB3630D8}" />
</filter>
</link-entity>
</entity>
</fetch>
But instead of retrieving a single result, the fetchxml tester returned multiple results as follows:
<resultset morerecords="0">
<result>
<scheduledstart_min date="11/7/2015" time="8:00 AM">2015-11-07T08:00:00+02:00</scheduledstart_min>
<activitytypecode_min name="Email" formattedvalue="4202">4202</activitytypecode_min>
<activitytypecode_min_activitytypecodename>Email</activitytypecode_min_activitytypecodename>
</result>
<result>
<scheduledstart_min date="11/8/2015" time="8:00 AM">2015-11-08T08:00:00+02:00</scheduledstart_min>
<activitytypecode_min name="Phone Call" formattedvalue="4210">4210</activitytypecode_min>
<activitytypecode_min_activitytypecodename>Phone Call</activitytypecode_min_activitytypecodename>
</result>
<result>
<scheduledstart_min date="11/4/2015" time="8:00 AM">2015-11-04T08:00:00+02:00</scheduledstart_min>
<activitytypecode_min name="Task" formattedvalue="4212">4212</activitytypecode_min>
<activitytypecode_min_activitytypecodename>Task</activitytypecode_min_activitytypecodename>
</result>
</resultset>
Can you help me with why it is retrieving multiple results although it has an aggregate function?
*This post is locked for comments
I have the same question (0)