Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Pull last login date/time from audit entity (old fetchxml query no longer working)

Posted on by 725

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>

  • TylerS.Dev Profile Picture
    TylerS.Dev 725 on at
    RE: Pull last login date/time from audit entity (old fetchxml query no longer working)

    This plugin pulls all login data by each user but it throws error when attempting to export to excel (message below), also, I don't want every login entries for each user, just the latest login date and time for all users, I don't see this functionality in this plugin.

    System.IO.FileNotFoundException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

    File name: 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

      at BDK.XrmToolBox.UserAuditViewer.PluginControl.ExportDataSet(DataSet ds, String destination)

      at BDK.XrmToolBox.UserAuditViewer.PluginControl.loginHistoryToolStripMenuItem_Click(Object sender, EventArgs e)

      at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)

      at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)

      at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)

      at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)

      at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)

      at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)

      at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

      at System.Windows.Forms.Control.WndProc(Message& m)

      at System.Windows.Forms.ToolStrip.WndProc(Message& m)

      at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)

      at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    WRN: Assembly binding logging is turned OFF.

    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

    Note: There is some performance penalty associated with assembly bind failure logging.

    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pull last login date/time from audit entity (old fetchxml query no longer working)

    Hi TylerS,

    You can use User Audit Viewer XrmToolBox Plugin for getting the user audit details.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans