---
title: "Codeunit 3994 Reten. Pol. Doc. Arch. Fltrng., extension points 29"
author: "JOP-AL"
url: https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/points/
object: https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/
app: "Base Application"
major: 29
source: https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/
checked: 2026-11-20
changed: 2026-10-05
subject: "Microsoft Dynamics 365 Business Central"
license: "Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/"
---

# Codeunit 3994 Reten. Pol. Doc. Arch. Fltrng., extension points 29

JOP-AL, https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/points/

9 procedures and triggers with a step in src/Layers/W1/BaseApp/OtherCapabilities/RetentionPolicy/RetenPolDocArchFltrng.Codeunit.al, in source order, read from the text, not from a run.

## ApplyRetentionPolicySubSetFilters

[Line 36](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L36).

- [46](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L46) calls [Codeunit 3917 Record Reference](https://jonas-paprotka.de/ref/codeunit/3917-record-reference/) `Initialize`
- [53](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L53) calls `GetYoungestExpirationDate`
- [54](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L54) calls `Yesterday`
- [55](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L55) calls `Yesterday`
- [56](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L56) calls `GetOldestRecordDate`
- [60](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L60) calls [Codeunit 3908 Retention Policy Log](https://jonas-paprotka.de/ref/codeunit/3908-retention-policy-log/) `LogInfo`
- [60](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L60) calls `LogCategory`
- [70](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L70) calls `MarkRecordRefWithRecordsToDelete`
- [72](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L72) calls `UnMarkRecordRefWithRecordsToKeep`
- [76](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L76) calls `Count`
- [77](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L77) calls `MaxNumberOfRecordsToDelete`
- [87](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L87) calls [Codeunit 3908 Retention Policy Log](https://jonas-paprotka.de/ref/codeunit/3908-retention-policy-log/) `LogInfo`
- [87](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L87) calls `LogCategory`

## GetYoungestExpirationDate

[Line 91](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L91), local.

- [102](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L102) calls `CalculateExpirationDate`

## ValidateExpirationDate

[Line 154](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L154), local.

- [162](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L162) calls [Codeunit 3905 Reten. Pol. Allowed Tables](https://jonas-paprotka.de/ref/codeunit/3905-reten-pol-allowed-tables/) `CalcMinimumExpirationDate`
- [164](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L164) calls [Codeunit 3908 Retention Policy Log](https://jonas-paprotka.de/ref/codeunit/3908-retention-policy-log/) `LogError`
- [164](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L164) calls `LogCategory`
- [164](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L164) calls [Codeunit 3905 Reten. Pol. Allowed Tables](https://jonas-paprotka.de/ref/codeunit/3905-reten-pol-allowed-tables/) `GetMandatoryMinimumRetentionDays`

## MarkRecordRefWithRecordsToDelete

[Line 167](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L167), local.

- [169](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L169) calls `SetMarksOnRecordRef`

## UnMarkRecordRefWithRecordsToKeep

[Line 172](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L172), local.

- [174](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L174) calls `SetMarksOnRecordRef`

## SetMarksOnRecordRef

[Line 177](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L177), local.

- [185](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L185) calls `UseKeepLastVersion`
- [192](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L192) calls `CalculateExpirationDate`
- [194](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L194) calls `ValidateExpirationDate`
- [197](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L197) calls `SetRetentionPolicyLineTableFilter`
- [200](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L200) calls `Yesterday`
- [204](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L204) calls [Codeunit 3910 Apply Retention Policy](https://jonas-paprotka.de/ref/codeunit/3910-apply-retention-policy/) `SetWhereOlderExpirationDateFilter`
- [205](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L205) calls [Codeunit 3910 Apply Retention Policy](https://jonas-paprotka.de/ref/codeunit/3910-apply-retention-policy/) `SetSingleDateExpirationDateFilter`
- [206](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L206) calls `SetMarks`
- [208](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L208) calls `Yesterday`
- [210](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L210) calls `Yesterday`
- [212](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L212) calls [Codeunit 3910 Apply Retention Policy](https://jonas-paprotka.de/ref/codeunit/3910-apply-retention-policy/) `SetWhereNewerExpirationDateFilter`
- [213](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L213) calls `SetMarks`
- [216](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L216) calls `ClearFilterGroupOnRecRef`
- [217](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L217) calls `ClearFilterGroupOnRecRef`

## SetMarks

[Line 221](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L221), local.

- [227](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L227) calls `IsMaxArchivedVersion`
- [232](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L232) calls `Yesterday`
- [235](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L235) calls `IsMaxArchivedVersion`

## IsMaxArchivedVersion

[Line 253](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L253), local.

- [284](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L284) raises `OnIsMaxArchivedVersionOnCaseElse`

## SetRetentionPolicyLineTableFilter

[Line 295](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L295), local.

- [298](https://jonas-paprotka.de/ref/codeunit/3994-reten-pol-doc-arch-fltrng/source/#L298) calls [Table 3902 Retention Policy Setup Line](https://jonas-paprotka.de/ref/table/3902-retention-policy-setup-line/) `GetTableFilterView`

## Source

AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at 4303e5e584d3aa5d9e98cbc615525a5396ad6ed7.

JOP-AL, 2026-11-20.
