I have been running fetchxml script below to generate last login report for our license management team. Around May 2021, I start receiving "aggregation not supported" error when running this same script in fetchxml builder / Xrm Tool box.
I have reached out to Microsoft Premier Support and their answer was :
"we got an update that there is a change of “Audit Storage” from Microsoft backend bringing this change to the “FetchXml” request behavior.
Audit has got migrated from SQL to Cosmos DB, since it has migrated to cosmos DB, the fetchxml approach will not work. This
A communication has been already rolled out to all the tenants 6 months ago and you should find the details of this feature(before it was scheduled to be deployed) in your message centre.
Please check the notifications in our message center about this change documentation."
So far, I have not been able to receive any answer regarding what alternatives we have to retrieve the last login date/time by user data, if anyone was able to find an alternative solution, please let me know.
<fetch aggregate="true" >
<entity name="audit" >
<attribute name="createdon" alias="LastLoginDate" aggregate="max" />
<filter type="and" >
<condition attribute="action" operator="eq" value="64" />
<condition attribute="createdon" operator="last-x-days" value="100" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="objectid" link-type="outer" alias="SystemUser" >
<attribute name="fullname" alias="Name" groupby="true" />
<attribute name="title" alias="Title" groupby="true" />
<attribute name="internalemailaddress" alias="Email" groupby="true" />
<filter>
<condition attribute="firstname" operator="neq" value="#" />
</filter>
</link-entity>
</entity>
</fetch>