---
id: object/codeunit/3905
type: object
title: Codeunit 3905 "Reten. Pol. Allowed Tables"
summary: Codeunit 3905 "Reten. Pol. Allowed Tables" in System Application (System.DataAdministration). 19 public procedures, 1 events, 3 event subscribers. Present since at least BC23, still in BC30, changed in BC28.
tier: official
language: en
tags:
  - codeunit
  - system application
versions:
  introduced: null
  last_changed: "28"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 32591d177021b64090052cca684ccea212652209ee8f1b8e314fd2dafc68a347
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Retention%20Policy/src/Retention%20Policy%20Allowed%20Tables/RetenPolAllowedTables.Codeunit.al
    title: src/System Application/App/Retention Policy/src/Retention Policy Allowed Tables/RetenPolAllowedTables.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 3905
name: Reten. Pol. Allowed Tables
namespace: System.DataAdministration
app: System Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 23
  events: 1
  subscribers: 3
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 5
  calls: 2
  called_by: 10
  implements: 0
---

# Codeunit 3905 "Reten. Pol. Allowed Tables"

> Codeunit 3905 "Reten. Pol. Allowed Tables" in System Application (System.DataAdministration). 19 public procedures, 1 events, 3 event subscribers. Present since at least BC23, still in BC30, changed in BC28.

System Application · System.DataAdministration · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Retention%20Policy/src/Retention%20Policy%20Allowed%20Tables/RetenPolAllowedTables.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Public |
| Permissions | tabledata Field = r, tabledata "Retention Policy Allowed Table" = r |

## Events published

- `OnRefreshAllowedTables()` (integration): This event is called when the user chooses to refresh the allowed tables.
  - subscribers: [Codeunit 1596 "Email Installer"](../codeunit/1596.md) AddAllowedTablesOnRefreshAllowedTables, [Codeunit 1933 "Performance Profiler Installer"](../codeunit/1933.md) AddAllowedTablesOnRefreshAllowedTables, [Codeunit 30273 "Shpfy Installer"](../codeunit/30273.md) AddAllowedTablesOnRefreshAllowedTables, [Codeunit 3907 "Retention Policy Installer"](../codeunit/3907.md) AddAllowedTablesOnRefreshAllowedTables, [Codeunit 3999 "Reten. Pol. Install - BaseApp"](../codeunit/3999.md) AddAllowedTablesOnRefreshAllowedTables

## Event subscriptions

- VerifyInsertAllowed subscribes to Table "Retention Policy Allowed Table" OnBeforeInsertEvent
- ErrorOnBeforeRenameAllowedTable subscribes to Table "Retention Policy Allowed Table" OnBeforeRenameEvent
- VerifyModifyAllowed subscribes to Table "Retention Policy Allowed Table" OnBeforeModifyEvent

## Procedures

- `AddAllowedTable(TableId: Integer): Boolean`: Adds a table to the list of allowed tables.
- `AddAllowedTable(TableId: Integer; DefaultDateFieldNo: Integer): Boolean`: Adds a table to the list of allowed tables.
- `AddAllowedTable(TableId: Integer; DefaultDateFieldNo: Integer; MandatoryMinRetenDays: Integer): Boolean`: Adds a table to the list of allowed tables.
- `AddAllowedTable(TableId: Integer; DefaultDateFieldNo: Integer; TableFilters: JsonArray): Boolean`: Adds a table to the list of allowed tables.
- `AddAllowedTable(TableId: Integer; TableFilters: JsonArray): Boolean`: Adds a table to the list of allowed tables.
- `AddAllowedTable(TableId: Integer; DefaultDateFieldNo: Integer; MandatoryMinRetenDays: Integer; RetenPolFiltering: Enum "Reten. Pol. Filtering"; RetenPolDeleting: Enum "Reten. Pol. Deleting"; TableFilters: JsonArray): Boolean`: Adds a table to the list of allowed tables.
- `AddTableFilterToJsonArray(var TableFilters: JsonArray; RetentionPeriodEnum: Enum "Retention Period Enum"; DateFieldNo: Integer; Enabled: Boolean; Locked: Boolean; RecordRef: RecordRef)`: This helper method is used to build an array of table filters which will be inserted automatically when creating a retention policy for the allowed table. You must first build up the array by calling this helper function and adding all relevant table filter information before passing the JsonArray t...
- `AddTableFilterToJsonArray(var TableFilters: JsonArray; RetPeriodCalc: DateFormula; DateFieldNo: Integer; Enabled: Boolean; Locked: Boolean; RecordRef: RecordRef)`: This helper method is used to build an array of table filters which will be inserted automatically when creating a retention policy for the allowed table. You must first build up the array by calling this helper function and adding all relevant table filter information before passing the JsonArray t...
- `RemoveAllowedTable(TableId: Integer): Boolean`: Removes a table from the list of allowed tables.
- `IsAllowedTable(TableId: Integer): Boolean`: Checks whether a table exists in the list of allowed tables.
- `GetAllowedTables(var AllowedTables: List of [Integer])`: Returns the allowed tables as a list.
- `GetAllowedTables(): Text`: Returns the allowed tables as a filter string.
- `GetRetenPolFiltering(TableId: Integer): Enum "Reten. Pol. Filtering"`: Returns the enum value set for retention policy filtering. This determines which code will handle the filtering of records when the retention policy for the allowed table is applied.
- `GetRetenPolDeleting(TableId: Integer): Enum "Reten. Pol. Deleting"`: Returns the enum value set for retention policy deleting. This determines which code will handle the deleting of records when the retention policy for the allowed table is applied.
- `GetDefaultDateFieldNo(TableId: Integer): Integer`: Returns the number of the date or datetime field in the list of allowed tables for the given table.
- `GetMandatoryMinimumRetentionDays(TableId: Integer): Integer`: Returns the mandatory minimum number of retention days for the given table.
- `CalcMinimumExpirationDate(TableId: Integer): Date`: Calculates the minimum expiration date for a given allowed table based on the minimum number of retention days and today's date.
- `SetTruncateAllowed(TableId: Integer; TruncateAllowed: Boolean)`: Sets whether truncation is allowed for a given table.
- `IsTruncateAllowed(TableId: Integer): Boolean`: Checks whether truncation is allowed for a given table.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 3906 "Reten. Pol. Allowed Tbl. Impl."](../codeunit/3906.md) (14 calls: `AddAllowedTable → AddToAllowedTables`, `AddTableFilterToJsonArray → AddTableFilterToJsonArray`, `CalcMinimumExpirationDate → CalcMinimumExpirationDate`, …)
- [Codeunit 3908 "Retention Policy Log"](../codeunit/3908.md) (1 call: `ErrorOnBeforeRenameAllowedTable → LogError`)

## Called by

- [Codeunit 3999 "Reten. Pol. Install - BaseApp"](../codeunit/3999.md) (19 calls: `AddChangeLogEntryToAllowedTables → AddAllowedTable`, `AddChangeLogEntryToAllowedTables → AddTableFilterToJsonArray`, `AddCRMIntegrationSynch → AddAllowedTable`, …)
- [Codeunit 3903 "Retention Policy Setup Impl."](../codeunit/3903.md) (3 calls: `NotifyOnMissingReadPermission → GetRetenPolFiltering`, `TableIdLookup → GetAllowedTables`, `VerifyRetentionPolicyAllowedTablesOnBeforeInsertRetenPolSetup → IsAllowedTable`)
- [Codeunit 3904 "Apply Retention Policy Impl."](../codeunit/3904.md) (3 calls: `CanApplyRetentionPolicy → IsAllowedTable`, `DeleteExpiredRecords → GetRetenPolDeleting`, `GetExpiredRecords → GetRetenPolFiltering`)
- [Codeunit 3915 "Reten. Pol. Filtering Impl."](../codeunit/3915.md) (2 calls: `ValidateExpirationDate → CalcMinimumExpirationDate`, `ValidateExpirationDate → GetMandatoryMinimumRetentionDays`)
- [Codeunit 3994 "Reten. Pol. Doc. Arch. Fltrng."](../codeunit/3994.md) (2 calls: `ValidateExpirationDate → CalcMinimumExpirationDate`, `ValidateExpirationDate → GetMandatoryMinimumRetentionDays`)
- [Codeunit 6450 "Serv. Integration Mgt."](../codeunit/6450.md) (2 calls: `InstallRetentionPolicies_OnAfterAddDocumentArchiveTablesToAllowedTables → AddAllowedTable`, `InstallRetentionPolicies_OnAfterAddDocumentArchiveTablesToAllowedTables → AddTableFilterToJsonArray`)
- [Codeunit 1933 "Performance Profiler Installer"](../codeunit/1933.md) (1 call: `AddRetentionPolicyAllowedTables → AddAllowedTable`)
- [Codeunit 8390 "Financial Report Auditing"](../codeunit/8390.md) (1 call: `AddRetentionPolicy → AddAllowedTable`)
- [Page 3903 "Retention Policy Setup List"](../page/3903.md) (1 call: `OnOpenPage → OnRefreshAllowedTables`)
- [Page 9040 "Data Administration Guide"](../page/9040.md) (1 call: `MaxRetentionPolicyCount → GetAllowedTables`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC28

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Reten. Pol. Allowed Tables")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
