I am trying to write a report that lists our CRM users and the number of times (from the Audit entity) that they have connected between 2 dates.
The link from the systemuser entity to the audit entity, works when I make it select the records from the audit entity, but due to the number of records returned, I just want a count of the audit records.
I can't get the syntax correct for the groupby/count clauses, can anyone see where I've gone wrong.
<fetch distinct="false" no-lock="false" mapping="logical" aggregate="true" >
<entity name="systemuser">
<attribute name="fullname" groupby='true' />
<filter type='and'>
<condition attribute='siteid' operator='not-null' />
<condition attribute='siteid' operator='ne' value='' />
<condition attribute='isdisabled' operator='eq' value='0' />
</filter>
<link-entity name='audit' from='objectid' to='systemuserid' alias='Audit' aggregate="true" link-type='outer' >
<attribute name="createdon" aggregate="count" alias="RecC" />
<filter type='and'>
<condition attribute='action' operator='eq' value='64'/>
<condition attribute='createdon' operator='between'>
<value>@StartDate</value>
<value>@EndDate</value>
</condition>
</filter>
</link-entity>
</entity>
</fetch>