{"title":"Define retention policies","url":"https://jonas-paprotka.de/docs/admin-data-retention-policies/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/admin-data-retention-policies, MicrosoftDocs/dynamics365smb-docs at 46907ac (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/admin-data-retention-policies","source":{"name":"Business Central application docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-docs","commit":"46907ace177f8d31deba47a2fdb57c3336e66252","date":"2026-11-19"},"checked":"2026-11-19","description":"You can specify how often you want to delete certain types of data.","date":"2026-03-02","meta":{"topic":"how-to"},"outline":[{"level":1,"title":"Define retention policies","slug":"define-retention-policies","at":0,"chars":7638},{"level":2,"title":"Required setups and permissions","slug":"required-setups-and-permissions","at":410,"chars":3333},{"level":3,"title":"Create retention periods","slug":"create-retention-periods","at":2052,"chars":433},{"level":3,"title":"Set up a retention policy","slug":"set-up-a-retention-policy","at":2485,"chars":1258},{"level":4,"title":"Video guidance","slug":"video-guidance","at":3563,"chars":180},{"level":2,"title":"Apply retention policies","slug":"apply-retention-policies","at":3743,"chars":863},{"level":2,"title":"View retention policies log entries","slug":"view-retention-policies-log-entries","at":4606,"chars":207},{"level":2,"title":"Include your extension in a retention policy (requires help from a developer)","slug":"include-your-extension-in-a-retention-policy-requires-help-from-a-developer","at":4813,"chars":2376},{"level":2,"title":"Related information","slug":"related-information","at":7189,"chars":449}],"text":"# Define retention policies\nThis article describes how 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.\n## Required setups and permissions\nBefore you can create retention policies, you must set up the tables to include and the periods of time to keep data.\nSetup|Description\nAllowed Tables|We provide a list of tables that you can include in retention policies. If you want to add tables from an extension to a retention policy, a developer must add their tables to the list. See #include-your-extension-in-a-retention-policy-requires-help-from-a-developer.\nRetention Periods|Specify periods of time for which to keep data in the tables in a policy. The periods determine how often data is deleted.\nAlso, you must have the SUPER user permissions or the Retention Policy Setup permission set. Users who have the Retention Policy Setup permission set can define retention policies for tables, even if they don't have Read and Delete permissions for the tables. The job queue entry must run as a user with permissions to read and delete the data. Don't grant the Retention Policy Setup permission set to users who shouldn't be allowed to delete data.\n> NOTE\n> If you're using Business Central on-premises and you want to try out retention policies in the Cronus demonstration database, there are a few things you need to do. The demonstration company doesn't contain tables that you can use with retention policies, so you need to add them. To do that, create a new, blank company in the demonstration database. In the new company, import the RapidStart configuration package for your country/region that corresponds to the standard NAV17.0.W1.ENU.STANDARD.rapidstart package. The setup data for retention policies are available in the new company.\n### Create retention periods\nRetention periods can be as long or as short as you want. To create retention periods, on the Retention Policies page, use the Retention Period action. The periods you define are available for all policies.\n> NOTE\n> For compliance reasons, we defined a minimum retention period for some tables. If you set a retention period that's shorter than minimum required, a message displays the mandatory period.\n### Set up a retention policy\n1. Select Search (Alt+Q) in the upper-right corner, enter Retention Policies, and choose the related link.\n2. Select New to create a new retention policy.\n3. In the Table ID field, choose the table that you want to include in the policy.\n4. In the Retention Period field, specify the length of time for which to keep the data in the table.\n5. 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 applies only to the records that the filters return. To specify the filter criteria, turn off the Apply to all records toggle. The Record Retention Policy FastTab displays, where you can set filter criteria. To learn more about how filters work, go to ui-enter-criteria-filters#filtering.\n> NOTE\n> Each line has its own retention period. If you specify different retention periods for the same data, the longest period is used. Also, some tables contain filters that you can't change or remove. To help you identify these filters, they appear in a lighter color font.\n#### Video guidance\nThis video provides an example of how to set up a retention policy.\n> Video<https://learn-video.azurefd.net/vod/player?id=511928c9-f956-45f6-8748-0c96f7ff0d33>\n## Apply retention policies\nYou can use a job queue entry to apply retention policies to delete data automatically, or you can manually apply policies.\nTo 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 it according to its retention period. All retention policies use the same job queue entry. By default, the job queue entry applies the policy every day at 0200. You can change the default, but if you do we recommend that it runs outside business hours. See Use Job Queues to Schedule Tasks<admin-job-queues-schedule-tasks>.\nYou can manually apply a policy by using the Apply Manually action on the Retention Policies page. If you want to always apply a policy manually, turn on the Manual toggle. The job queue entry disregards the policy when it runs.\n## View retention policies log entries\nYou 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.\n## Include your extension in a retention policy (requires help from a developer)\nBy default, retention policies cover only Business Central in the list we provide. You can remove default tables from the list, and you can add tables that you own. That is, you can't add a table that you didn't create yourself. For example, you can't add other tables from Business Central or from an extension that you purchased.\nTo add your tables to the list of allowed tables, a developer must add some code. For example, to the installer codeunit for the extension (a codeunit with the install subtype).\nWhen a developer adds a table, they can specify mandatory and default filters. Mandatory filters can't be removed or modified later when you add tables to define a retention policy. The default filters are just suggestions.\nThe following are examples of how to add a table to the list of allowed tables with, and without, mandatory or default filters. For a more complex example, go to codeunit 3999 \"Reten. Pol. Install - BaseApp\".\n```al\n trigger OnInstallAppPerCompany()\n    var\n        RetenPolAllowedTables: Codeunit \"Reten. Pol. Allowed Tables\";\n    begin\n        RetenPolAllowedTables.AddAllowedTable(Database::\"Retention Policy Log Entry\");\n    end;\n```\nThe following example includes a mandatory filter.\n```al\n trigger OnInstallAppPerCompany()\n    var\n        ChangeLogEntry: Record \"Change Log Entry\";\n        RetenPolAllowedTables: Codeunit \"Reten. Pol. Allowed Tables\";\n        RetentionPeriod: Enum \"Retention Period Enum\";\n        RecRef: RecordRef;\n        TableFilters: JsonArray;\n        Enabled: Boolean;\n        Mandatory: Boolean;\n    begin\n        ChangeLogEntry.Reset();\n        ChangeLogEntry.SetFilter(\"Field Log Entry Feature\", '%1|%2', ChangeLogEntry.\"Field Log Entry Feature\"::\"Monitor Sensitive Fields\", ChangeLogEntry.\"Field Log Entry Feature\"::All);\n        RecRef.GetTable(ChangeLogEntry);\n        Enabled := true;\n        Mandatory := true;\n        RetenPolAllowedTables.AddTableFilterToJsonArray(TableFilters, RetentionPeriod::\"28 Days\", ChangeLogEntry.FieldNo(SystemCreatedAt), Enabled, Mandatory, RecRef);\n        RetenPolAllowedTables.AddAllowedTable(Database::\"Change Log Entry\", ChangeLogEntry.FieldNo(SystemCreatedAt), TableFilters);\n    end;\n```\nAfter a developer adds tables to the list, an administrator can include them in a retention policy.\n## Related information\nAnalyzing Retention Policy Trace Telemetry<dev-itpro/administration/telemetry-retention-policy-trace>\nAuditing Changes in Business Central<across-log-changes>\nui-enter-criteria-filters#filtering\nUse Job Queues to Schedule Tasks<admin-job-queues-schedule-tasks>\nWork with Business Central<ui-work-product>\nFind free e-learning modules for Business Central here<https://learn.microsoft.com/training/dynamics365/business-central>"}