My Account entity data like this:
ownerid accountid(PrimaryKey) new_name
user1 3E69C24F-FFA8-... CompanyA
user1 4E23C24F-FFA8-... CompanyB
user2 5T32C24F-FFA8-... CompanyA
user3 6G32C24F-FFA8-... CompanyC
Now,I want use fetchxml aggregate query to get result like this:
ownerid accountquantity
user1 2
user2 1
user3 1
But,I got a worng result when I use fectchxml aggregate query by "ownerid".My fetchxml like this:
string fetchxml = string.Format(@"
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' aggregate='true'>
<entity name='account'>
<attribute name='ownerid' alias='ownerid' groupby='true' />
<attribute name='accountid' alias='countnum' aggregate='count' />
<filter type='and'>
<condition attribute='new_status' operator='eq' value='10' />
<condition attribute='statecode' operator='eq' value='0' />
</filter>
</entity>
</fetch>");
Dynamic CRM version is 8.2. what's wrong in the fetchxml?
Thanks!