In this post, we explore why government organizations can benefit from a one true connected enterprise solution.
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:
2. Select the Audit Log you wish to delete and click Delete Logs.
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!
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=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B015AC8CDetail:
<OrganizationServiceFault xmlns_i="http://www.w3.org/2001/XMLSchema-instance" http://schemas.microsoft.com/xrm/2011/Contracts">http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorDetails xmlns_d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B015AC8C</Message>
<ErrorDetails xmlns_d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>There are no partitions ending before the given date</Message>
<InnerFault i_nil="true" />
<TraceText i_nil="true" />
<TraceText i_nil="true" />
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.
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!