microsoft / ALAppExtensions

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

[Event Request] Codeunit 12 "Gen. Jnl.-Post Line" - Function "ApplyBill" - New Event OnBeforeApplyBill #22588

Closed FabioC34 closed 1 year ago

FabioC34 commented 1 year ago

Hello, we need the possibility to extend the Function "ApplyBill" on "Gen. Jnl.-Post Line" Codeunit (12) as follows:

    [Scope('OnPrem')]
    procedure ApplyBill(var NewCustLedgEntry: Record "Cust. Ledger Entry")
    var
        OldCustLedgEntry: Record "Cust. Ledger Entry";

        //new-s
        IsHandled: Boolean;
        //new-e   

    begin

        //new-s
        IsHandled := false;
        OnBeforeApplyBill(NewCustLedgEntry, IsHandled);
        if IsHandled then
            exit;
        //new-e   

        if NewCustLedgEntry."Document Type" = NewCustLedgEntry."Document Type"::Dishonored then begin
            OldCustLedgEntry.Reset();
            OldCustLedgEntry.SetCurrentKey("Closed by Entry No.");
            OldCustLedgEntry.SetRange("Closed by Entry No.", NewCustLedgEntry."Entry No.");
            if OldCustLedgEntry.FindSet() then
                repeat
                    HandleBill(OldCustLedgEntry, false);
                until OldCustLedgEntry.Next() = 0;
        end else
            if not NewCustLedgEntry.Open then
                HandleBill(NewCustLedgEntry, false);
    end;
    [IntegrationEvent(false, false)]
    local procedure OnBeforeApplyBill(var NewCustLedgEntry: Record "Cust. Ledger Entry"; var IsHandled: Boolean)
    begin
    end;
JesperSchulz commented 1 year ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 11010.