microsoft / ALAppExtensions

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

[Event Request] Codeunit 13 "Gen. Jnl.-Post Batch" - OnBeforeCheckAllocations #27001

Open RZ440 opened 1 month ago

RZ440 commented 1 month ago

Describe the request

Hello, can you please add a new event OnBeforeCheckAllocations in codeunit 13 "Gen. Jnl.-Post Batch"?

    local procedure CheckAllocations(var GenJnlLine2: Record "Gen. Journal Line")
    var
        ShowAllocationsRecurringError: Boolean;
        IsHandled: Boolean;
    begin
        if GenJnlLine2."Account No." <> '' then begin
            if GenJnlLine2."Recurring Method" in
               [GenJnlLine2."Recurring Method"::"B  Balance",
                GenJnlLine2."Recurring Method"::"RB Reversing Balance"]
            then begin
                IsHandled := false;
                OnBeforeCheckAllocations(GenJnlLine2, IsHandled);
                if IsHandled then
                     exit;
                GenJnlAlloc.Reset();
                GenJnlAlloc.SetRange("Journal Template Name", GenJnlLine2."Journal Template Name");
                GenJnlAlloc.SetRange("Journal Batch Name", GenJnlLine2."Journal Batch Name");
                GenJnlAlloc.SetRange("Journal Line No.", GenJnlLine2."Line No.");
                if GenJnlAlloc.IsEmpty() then
                    Error(
                      Text028);
            end;
    [IntegrationEvent(false, false)]
    local procedure OnBeforeCheckAllocations(var GenJournalLine2: Record "Gen. Journal Line"; var IsHandled: Boolean)
    begin
    end;

Additional context

We would like to run our own checks and skip yours. Internal work item: AB#545270