microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
768 stars 610 forks source link

[Event Change Request] Codeunit 3904 Apply Retention Policy Impl. - procedure ApplyRetentionPolicy- event OnAfterApplyRetentionPolicy #26947

Open ChrSt89 opened 1 month ago

ChrSt89 commented 1 month ago

Describe the request

Please add the following Event/-s OnAfterApplyRetentionPolicy to procedure ApplyRetentionPolicy in Codeunit 3904 Apply Retention Policy Impl.

ApplyRetentionPolicy(UserInvokedRun: Boolean)
    var
        RetentionPolicySetup: Record "Retention Policy Setup";
        RetentionPolicyLog: Codeunit "Retention Policy Log";
        Dialog: Dialog;
    begin
        RetentionPolicyLog.LogInfo(LogCategory(), AppendStartedByUserMessage(StartApplyRetentionPoliciesInfoLbl, UserInvokedRun));

        ApplyAllRetentionPolicies := true;

        RetentionPolicySetup.SetRange(Enabled, true);
        RetentionPolicySetup.SetRange(Manual, false);
        if RetentionPolicySetup.FindSet(false) then begin
            if GuiAllowed() then begin
                Dialog.HideSubsequentDialogs(true);
                Dialog.Open(WaitDialogMsg);
            end;

            repeat
                if UserInvokedRun then
                    // allow errors to bubble up
                    ApplyRetentionPolicy(RetentionPolicySetup, false, UserInvokedRun)
                else
                    // suppress errors
                    SafeApplyRetentionPolicy(RetentionPolicySetup)
            until (RetentionPolicySetup.Next() = 0) or EndCurrentRun;

            if GuiAllowed() then
                Dialog.Close();
        end;
        RetentionPolicyLog.LogInfo(LogCategory(), AppendStartedByUserMessage(EndApplyRetentionPoliciesInfoLbl, UserInvokedRun));

        if ContinueWithRerun then
            Codeunit.Run(Codeunit::"Apply Retention Policy Impl.");

    OnAfterApplyRetentionPolicy(UserInvokedRun); <-- NEW EVENT
    end;
[IntegrationEvent(false, false)]
local procedure OnAfterApplyRetentionPolicy(UserInvokedRun: Boolean)
begin
end;

Additional context

IMPORTANT ADDITION

We need a way to read the records in the Retention Policy Log Entry table based on the session ID. The table is currently set to Internal.

Would a change be possible?

Affects the table Retention Policy Log Entry (ID 3905) Internal work item: AB#543568

azure-boards[bot] commented 1 month ago

✅ Successfully linked to Azure Boards work item(s):