table 50567 "Contoso Activity Log" { DataClassification = SystemMetadata; fields { field(1; "Entry No."; Integer) { AutoIncrement = true; } field(2; "Activity"; Text[250]) { } } keys { key(PK; "Entry No.") { Clustered = true; } } } codeunit 50563 "Contoso Activity Log Cleanup" { Access = Internal; // The log table is never added to the allowed tables, so it cannot appear // on the Retention Policies page. Cleanup is hard-coded here instead: // the period is not configurable, the deletion is not written to the // Retention Policy Log, and an administrator cannot switch it off. trigger OnRun() var ContosoActivityLog: Record "Contoso Activity Log"; begin ContosoActivityLog.SetFilter( SystemCreatedAt, '<%1', CreateDateTime(CalcDate('<-30D>', Today()), 0T)); ContosoActivityLog.DeleteAll(); end; }