Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications

|

Audit Log Management: Getting Past the “Unexpected Error”

Post Author: Joe D365 |

Today's post covers a specific error you may receive when trying to delete an Audit Log. Note that while Dynamics 365 users in both on-premises and online environments can manage the Audit Log, for purposes of demonstration today, we'll focus on managing the process in an on-premises environment only.

1. Start by clicking Settings > Auditing > Audit Log Management, as shown below:

audit log

audit log

2. Select the Audit Log you wish to delete and click Delete Logs.

audit log

3. If you didn't hit an error, congratulations! Today's blogpost wasn't meant for you. But if you did get an error like the one below, please keep reading!

audit log

4. In the error message box, click Download Log File. You will receive the following message: "There are no partitions ending before the given date." In context, it will look like this (note the highlighted portion):

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B015AC8CDetail:

http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">

  -2147220970

  http://schemas.datacontract.org/2004/07/System.Collections.Generic" />

  System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B015AC8C

  2018-11-19T14:59:57.82726Z

 

    -2147220989

    http://schemas.datacontract.org/2004/07/System.Collections.Generic" />

    There are no partitions ending before the given date

    2018-11-19T14:59:57.82726Z

   

   

 

 


This error is likely the result of direct deletes/changes being made to the audit table, as this is not a supported method of audit log management. Because the audit base table is partitioned, making direct SQL updates can lead to this type of issue. With that in mind, the next step in the process is recreate the audit base table. WARNING: since this is an unsupported change, it is advised that you take a full database backup before recreating the table!

5. To recreate the audit base table, log in with a user that has full read/write access to the CRM audit table. Expand the Indexes and right-click on the PrimaryKey_Audit index, as shown below. From the popup menu, select Script Index as > DROP And Create To > New Query Editor Window.

audit log

6. Run the query to recreate this index. Once this has been completed, you will be able to delete the log partition within Dynamics.

Now you know what to do when you hit that stubborn "Unexpected Error."

Need more Dynamics 365 tips and tricks? Be sure to subscribe to our blog for the latest!

Happy Dynamics 365'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends