microsoft / ALAppExtensions

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

[Event Request] Codeunit 12 "Gen. Jnl.-Post Line" - OnVendPostApplyVendLedgEntryOnBeforeApplyVendLedgEntry #27014

Closed RZ440 closed 1 month ago

RZ440 commented 2 months ago

Describe the request

In the Event Request #26859 we asked for a new event OnVendPostApplyVendLedgEntryOnBeforeApplyVendLedgEntry in Codeunit 12 "Gen. Jnl.-Post Line".

    procedure VendPostApplyVendLedgEntry(var GenJnlLinePostApply: Record "Gen. Journal Line"; var VendLedgEntryPostApply: Record "Vendor Ledger Entry")
.
.
.
        // Post the application
        VendLedgEntry.CalcFields(
          Amount, "Amount (LCY)", "Remaining Amount", "Remaining Amt. (LCY)",
          "Original Amount", "Original Amt. (LCY)");
        OnVendPostApplyVendLedgEntryOnBeforeCopyFromVendLedgEntry(GenJnlLine, CVLedgEntryBuf, VendLedgEntry);
        CVLedgEntryBuf.CopyFromVendLedgEntry(VendLedgEntry);
        OnVendPostApplyVendLedgEntryOnBeforeApplyVendLedgEntry(VendLedgEntry, GenJnlLine, CVLedgEntryBuf);
        ApplyVendLedgEntry(CVLedgEntryBuf, TempDtldCVLedgEntryBuf, GenJnlLine, Vend);
        OnVendPostApplyVendLedgEntryOnAfterApplyVendLedgEntry(GenJnlLine, TempDtldCVLedgEntryBuf);
        VendLedgEntry.CopyFromCVLedgEntryBuffer(CVLedgEntryBuf);
        VendLedgEntry.Modify(true);
        // Post Dtld vendor entry
        OnVendPostApplyVendLedgEntryOnBeforePostDtldVendLedgEntries(VendLedgEntry);
        DtldLedgEntryInserted := PostDtldVendLedgEntries(GenJnlLine, TempDtldCVLedgEntryBuf, VendPostingGr, false);

        CheckPostUnrealizedVAT(GenJnlLine, true);
    [IntegrationEvent(false, false)]
    local procedure OnVendPostApplyVendLedgEntryOnBeforeApplyVendLedgEntry(var VendorLedgerEntry: Record "Vendor Ledger Entry"; GenJournalLine: Record "Gen. Journal Line"; var CVLedgerEntryBuffer: Record "CV Ledger Entry Buffer")
    begin
    end;

Additional context

You rejected the request recommending to use OnVendPostApplyVendLedgEntryOnBeforeCopyFromVendLedgEntry. But we would like to set some fields in CVLedgEntryBuf to values from GenJnlLine instead of VendLedgEntry. If we filled the fields in OnVendPostApplyVendLedgEntryOnBeforeCopyFromVendLedgEntry they would be overwritten in CVLedgEntryBuf.CopyFromVendLedgEntry with values from VendLedgEntry. Internal work item: AB#544386

JesperSchulz commented 1 month 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: 24591.