microsoft / ALAppExtensions

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

[Event Request] codeunit 1250 "Match General Journal Lines" - OnPrepareCustLedgerEntryForApplicationOnBeforeSetAmountToApply #27200

Closed RZ440 closed 6 days ago

RZ440 commented 2 months ago

Describe the request

Hello, can you please add a new Event OnPrepareCustLedgerEntryForApplicationOnBeforeSetAmountToApply in codeunit 1250 "Match General Journal Lines"?

    procedure PrepareCustLedgerEntryForApplication(var CustLedgerEntry: Record "Cust. Ledger Entry"; var GenJournalLine: Record "Gen. Journal Line")
    begin
        CustLedgerEntry.CalcFields("Remaining Amount", "Remaining Amt. (LCY)");
        OnPrepareCustLedgerEntryForApplicationOnBeforeSetAmountToApply(CustLedgerEntry);
        CustLedgerEntry."Applies-to ID" := GenJournalLine."Document No.";
        if Abs(CustLedgerEntry."Remaining Amt. (LCY)") < Abs(GenJournalLine."Amount (LCY)") then
            CustLedgerEntry."Amount to Apply" := CustLedgerEntry."Remaining Amount"
        else
            CustLedgerEntry."Amount to Apply" := -GenJournalLine.Amount;

        CODEUNIT.Run(CODEUNIT::"Cust. Entry-Edit", CustLedgerEntry);
    end;
    [IntegrationEvent(false, false)]
    local procedure OnPrepareCustLedgerEntryForApplicationOnBeforeSetAmountToApply(var CustLedgerEntry: Record "Cust. Ledger Entry")
    begin
    end;

Additional context

We have additional values to calculate the Remaining Amount and need to recalculate it before being allocated and the record being modified. Internal work item: AB#547389

JesperSchulz commented 6 days ago

Availability update: We will publish a fix for this issue in the next update for release 25.

Build ID to track: 26242.