Skip to main content

Notifications

Announcements

No record found.

Customizing Retention Policies in Microsoft Dynamics 365 Business Central

What is a Retention Policy?
A retention policy is a set of rules that govern how long specific types of
data should be kept and when they should be deleted. These policies are
crucial for compliance with legal and regulatory requirements, as well as
for optimizing storage and improving system performance.
Which tables can be used in Retention Policy
In app development, it is necessary for the developer to specify which
tables are included in the Retention Policy. Microsoft provides certain
default tables in their applications. The following instructions will guide
you on how to incorporate a table into a custom application.

Steps to Customize Retention Policies in Business Central:
There are two methods to customize a Retention Policy where you can
add your custom or standard tables into a Retention Policy based on the
requirements.
1. Using app install codeunit.
2. Add tables dynamically.

Step 1:
Add your custom table to Retention Policy using app install codeunit.
The drawback of this method is whenever you need to add a new tables
then you have to add it again in the install codeunit and deploy the app
again.



Custom table is added into the Retention Policy allowed tables, Now you
can create a Retention Policy based on your requirements.




Now Step 2 :
Create a custom table and page where you can select multiple tables in
this custom table. Then create an action to add these tables to the
Retention Policy. For this method you don’t need a deployment every
time for adding new table to the Retention Policy.





When you click on the action all the selected tables in the above custom
table will be added to the Retention Policy Allowed tables and then you
can create a Retention Policy for any tables which you added.




The code behind the action is below.


Comments