Retrieve and delete the history of audited data changes
Applies To: CRM 2015 on-prem, CRM Online
After auditing is enabled and data changes are made to those entities and attributes being audited, you can proceed to obtain the data change history. Optionally, you can delete the audit records after you review the change history. Follow the sample code link at the end of this topic for more information.
There are several messages requests that can be used to retrieve the audit change history. These requests are differentiated by the nature of what they retrieve. Refer to the topic Audit entity messages and methods for a list of message requests related to auditing. Refer to the sample link at the end of this topic for sample code that demonstrates some of these change history message requests.
You can delete audit records using the DeleteAuditDataRequest request. Audit data records are deleted sequentially from the oldest to the newest. The functionality of this request is slightly different based on the edition of Microsoft SQL Server being used by your Microsoft Dynamics CRM server. Microsoft Dynamics CRM Online uses an enterprise edition of SQL Server.
If your Microsoft Dynamics CRM server uses Microsoft SQL Server standard edition, which does not support the database partitioning feature, the DeleteAuditDataRequest request deletes all audit records created up to the end date specified in the EndDate property.
If your Microsoft Dynamics CRM server uses an Enterprise edition of Microsoft SQL Server that does support partitioning, the DeleteAuditDataRequest request will delete all audit data in those partitions where the end date is before the date specified in the EndDate property. Any empty partitions are also deleted. However, neither the current (active) partition nor the audit records in that active partition can be deleted by using this request or any other request.
New partitions are automatically created by the Microsoft Dynamics CRM platform on a quarterly basis each year. This functionality is non-configurable and cannot be changed. You can obtain the list of partitions using the RetrieveAuditPartitionListRequest request. If the end date of any partition is later than the current date, you cannot delete that partition or any audit records in it.
Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online
Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.