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" - OnCreateGLEntryOnBeforeInsertGLEntry #27011

Closed RZ440 closed 1 month ago

RZ440 commented 2 months ago

Describe the request

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

    procedure CreateGLEntry(GenJnlLine: Record "Gen. Journal Line"; AccNo: Code[20]; Amount: Decimal; AmountAddCurr: Decimal; UseAmountAddCurr: Boolean)
    var
        GLEntry: Record "G/L Entry";
    begin
        if UseAmountAddCurr then
            InitGLEntry(GenJnlLine, GLEntry, AccNo, Amount, AmountAddCurr, true, true)
        else begin
            InitGLEntry(GenJnlLine, GLEntry, AccNo, Amount, 0, false, true);
            GLEntry."Additional-Currency Amount" := AmountAddCurr;
        end;
        OnCreateGLEntryOnBeforeInsertGLEntry(GenJnlLine, GLEntry, VATEntry);
        InsertGLEntry(GenJnlLine, GLEntry, true);

        OnAfterCreateGLEntry(GenJnlLine, GLEntry, NextEntryNo);
    end;
    [IntegrationEvent(false, false)]
    local procedure OnCreateGLEntryOnBeforeInsertGLEntry(GenJournalLine: Record "Gen. Journal Line"; var GLEntry: Record "G/L Entry"; VATEntry: Record "VAT Entry")
    begin
    end;

Additional context

You rejected the request recommending to use OnAfterCopyGLEntryFromGenJnlLine(Rec, GenJnlLine) in CopyFromGenJnlLine called from InitGLEntry. We are using OnAfterCopyGLEntryFromGenJnlLine to fill additional fields that are to be set in all G/L Entries. But some fields we would like to set only in G/L Entries created in CreateGLEntry, but in InitGLEntry/CopyFromGenJnlLine/OnAfterCopyGLEntryFromGenJnlLine we do not know where it is called from. Internal work item: AB#544384

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.