Data Clean-up with Business Central Retention Policies

Check out this blog and learn how Data Clean-up with Business Central Retention Policies enables you to avoid unnecessary database growth in D365 Business Central
Microsoft Dynamics 365 Business Central provides a useful feature for data management through retention policies, enabling administrators to automatically clean up outdated or unnecessary data from log entries and archived records. By defining retention periods and applying filters, users can ensure only relevant data is retained, helping streamline operations and reduce database clutter.
Retention policies can be applied manually or automatically via job queues, with full visibility into actions through policy logs. Developers can also extend these capabilities to include custom extension tables.
Define Retention Policies
Administrators can define retention policies to specify how often to delete outdated data in tables that contain log entries and archived records. For example, cleaning up log entries can make it easier to work with the more relevant data. Policies can delete data based on an expiration date, or you can add filters to include only certain expired data.
Required setups and permissions
Before you can create retention policies, you must set up the tables to include and the periods of time to keep data.
Setup | Description |
Allowed Tables | We provide a list of tables that you can include in retention policies. |
Retention Periods | Specify periods of time for which to keep data in the tables in a policy. |
Additionally, you must have the SUPER user permissions or the Retention Policy Setup permission set.
Create retention periods
To create retention periods, on the Retention Policies page, use the Retention Period action.
Set up a retention policy
- Choose the search icon, enter Retention Policies, and choose the related link.
- Select New to create a new retention policy.
- In the Table ID field, choose the table that you want to include in the policy.
- In the Retention Period field, specify the length of time for which to keep the data in the table.
- Optional: You can apply the policy to specific data in a table, rather than all records, by filtering the data for each line. The policy will apply only to the records that the filters return. To specify the filter criteria, turn off the Apply to all records The Record Retention Policy FastTab displays, where you can set filter criteria.
Apply retention policies
You can use a job queue entry to apply retention policies to delete data automatically, or you can manually apply policies.
- To apply a retention policy automatically, just create and enable a policy. When you enable a policy,, Business Central creates a job queue entry that applies the it according to its retention period. All retention policies will use the same job queue entry. By default, the job queue entry applies the policy every day at 02:00.AM You can change the default, but if you do we recommend that it runs outside business hours.
- You can manually apply a policy by using the Apply Manually action on the Retention Policies If you want to always apply a policy manually, turn on the Manual toggle. The job queue entry will disregard the policy when it runs.
Watch this short video to learn how to use retention policies to avoid unnecessary database growth in D365 Business Central
View retention policy log entries
You can view activity related to retention policies in the Retention Policy Log page. For example, entries are created when a policy is applied, or if errors occurred.
Include your extension in a retention policy
If you want to add tables from an extension to a retention policy, a developer must add their tables to the list. To learn more, go to Include your extension in a retention policy.
Conclusion
Retention policies in Business Central offer a practical way to manage data growth by systematically removing obsolete information. By setting up and applying these policies effectively, organisations can enhance system performance, improve data clarity, and reduce storage overhead. Whether you opt for manual control or automation, implementing retention policies is a smart step toward maintaining a lean and efficient ERP system.
Get the full Guide HERE