Codeunit 3910 "Apply Retention Policy"
System Application · System.DataAdministration
Across versions
- BC23-27present
- BC281 procedures added, 1 events added
- BC29-30unchanged
Neighbourhood 14 connected objects and pages
System Application · System.DataAdministration · BC23-30 · source at ea08af5e · facts from BC29
Properties
| Property | Value |
|---|---|
| Access | Public |
Events published
OnApplyRetentionPolicyRecordLimitExceeded(CurrTableId: Integer; NumberOfRecordsRemainingToBeDeleted: Integer; ApplyAllRetentionPolicies: Boolean; UserInvokedRun: Boolean; var Handled: Boolean)(integration): This event is raised once the maximum number of records which can be deleted in a single run is reached. The limit is defined internally and cannot be changed. The event can be used to schedule a new run to delete the remaining records.- subscribers: Codeunit 3997 “Retention Policy JQ” ScheduleJobQueueEntryOnApplyRetentionPolicyRecordLimitExceeded
OnApplyRetentionPolicyIndirectPermissionRequired(var RecRef: RecordRef; var Handled: Boolean)(integration)- subscribers: Codeunit 1598 “Email Logs Delete” DeleteRecordsWithIndirectPermissionsOnApplyRetentionPolicyIndirectPermissionRequired, Codeunit 1930 “Performance Profiler Delete” DeleteRecordsWithIndirectPermissionsOnApplyRetentionPolicyIndirectPermissionRequired, Codeunit 30274 “Shpfy Log Entries Delete” DeleteRecordsWithIndirectPermissionsOnApplyRetentionPolicyIndirectPermissionRequired, Codeunit 3913 “Retention Policy Logs Delete” DeleteRecordsWithIndirectPermissionsOnApplyRetentionPolicyIndirectPermissionRequired, Codeunit 3995 “Base Application Logs Delete” DeleteRecordsWithIndirectPermissionsOnApplyRetentionPolicyIndirectPermissionRequired, Codeunit 6450 “Serv. Integration Mgt.” DeleteRecordsWithIndirectPermissionsOnApplyRetentionPolicyIndirectPermissionRequired
OnTruncateRecordsIndirectPermissionRequired(var RecRef: RecordRef; var Handled: Boolean)+ BC28 (integration)- subscribers: Codeunit 3921 “Retention Policy Logs Truncate” TruncateRecordsWithIndirectPermissionsOnTruncateRecordsIndirectPermissionRequired, Codeunit 3993 “Base Application Logs Truncate” TruncateRecordsWithIndirectPermissionsOnTruncateRecordsIndirectPermissionRequired
Procedures
ApplyRetentionPolicy(UserInvokedRun: Boolean): Applies all enabled, non-manual retention polices. This will delete records according to the settings defined in the Retention Policy Setup table.ApplyRetentionPolicy(RetentionPolicySetup: Record "Retention Policy Setup"; UserInvokedRun: Boolean): Applies the given Retention Policy. This will delete records according to the settings defined in the Retention Policy Setup table.GetExpiredRecordCount(RetentionPolicySetup: Record "Retention Policy Setup"): Integer: Returns the number of expired records for the given Retention Policy Setup record. These records would be deleted if the Retention Policy was applied.GetExpiredRecordCount(RetentionPolicySetup: Record "Retention Policy Setup"; var ExpiredRecordExpirationDate: Date): Integer: Returns the number of expired records for the given Retention Policy Setup record. These records would be deleted if the Retention Policy was applied.SetWhereOlderExpirationDateFilter(DateFieldNo: Integer; ExpirationDate: Date; var RecordRef: RecordRef; FilterGroup: Integer; NullDateReplacementValue: Date): This method places a filter on the record reference where records are older than the ExpirationDate. The filter excludes any record where the date field specified in DateFieldNo has no value.SetWhereNewerExpirationDateFilter(DateFieldNo: Integer; ExpirationDate: Date; var RecordRef: RecordRef; FilterGroup: Integer; NullDateReplacementValue: Date): This method places a filter on the record reference where records are newer than the ExpirationDate. The filter excludes any record where the date field specified in DateFieldNo has no value.SetSingleDateExpirationDateFilter(DateFieldNo: Integer; ExpirationDate: Date; var RecordRef: RecordRef; FilterGroup: Integer; NullDateReplacementValue: Date): This method places a filter on the record reference where records are expired one day at the expiration date. The filter excludes any record where the date field specified in DateFieldNo has no value.TruncateTableRecords(RetentionPolicySetup: Record "Retention Policy Setup")+ BC28: Truncates all records in the table specified by the retention policy setup.
Triggers
OnRun
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 3904 “Apply Retention Policy Impl.” (7 calls:
ApplyRetentionPolicy → ApplyRetentionPolicy,GetExpiredRecordCount → GetExpiredRecordCount,OnRun → (object), …)
Called by
- Codeunit 3904 “Apply Retention Policy Impl.” (3 calls:
DeleteExpiredRecords → OnApplyRetentionPolicyIndirectPermissionRequired,RaiseRecordLimitExceededEvent → OnApplyRetentionPolicyRecordLimitExceeded,TruncateTableRecords → OnTruncateRecordsIndirectPermissionRequired) - Codeunit 3915 “Reten. Pol. Filtering Impl.” (3 calls:
ApplyRetentionPolicyAllRecordFilters → SetWhereOlderExpirationDateFilter,SetMarksOnRecordRef → SetSingleDateExpirationDateFilter,SetMarksOnRecordRef → SetWhereNewerExpirationDateFilter) - Codeunit 3994 “Reten. Pol. Doc. Arch. Fltrng.” (3 calls:
SetMarksOnRecordRef → SetSingleDateExpirationDateFilter,SetMarksOnRecordRef → SetWhereNewerExpirationDateFilter,SetMarksOnRecordRef → SetWhereOlderExpirationDateFilter) - Codeunit 3911 “PBT Expired Record Count” (1 call:
OnRun → GetExpiredRecordCount) - Codeunit 3997 “Retention Policy JQ” (1 call:
OnRun → (object))
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: "Apply Retention Policy"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.