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" - OnProcessLinesOnBeforePostGenJournalLine #26996

Open RZ440 opened 1 month ago

RZ440 commented 1 month ago

Describe the request

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

local procedure ProcessLines(var GenJnlLine: Record "Gen. Journal Line")
.
.
.
        // Post lines
        LineCount := 0;
        LastDocNo := '';
        LastPostedDocNo := '';
        LastICTransactionNo := 0;
        TempGenJnlLine4.DeleteAll();
        NoOfReversingRecords := 0;
        GenJnlLine.FindSet(true);
        FirstLine := true;
        ICProccessedLines := 0;
        repeat
            ErrorMessageMgt.PushContext(ErrorContextElement, GenJnlLine.RecordId, 0, PostingLinesMsg);
            IsHandled := false;
            OnProcessLinesOnBeforePostGenJournalLine(GenJnlLine, IsHandled);
            if not IsHandled then begin
                ProcessICLines(CurrentICPartner, ICTransactionNo, ICLastDocNo, ICLastDate, ICLastDocType, GenJnlLine, TempGenJnlLine, ICProccessedLines);
                ProcessICTransaction(LastICTransactionNo, ICTransactionNo);
                OnProcessLinesOnAfterProcessICTransaction(GenJnlLine);
                GenJnlLine3 := GenJnlLine;
                if not PostGenJournalLine(GenJnlLine3, CurrentICPartner, ICTransactionNo) then
                    SkippedLine := true;
            end;
            ErrorMessageMgt.PopContext(ErrorContextElement);
        until GenJnlLine.Next() = 0;

        if LastICTransactionNo > 0 then
            ICOutboxExport.ProcessAutoSendOutboxTransactionNo(ICTransactionNo);
    [IntegrationEvent(false, false)]
    local procedure OnProcessLinesOnBeforePostGenJournalLine(GenJournalLine: Record "Gen. Journal Line"; var IsHandled: Boolean)
    begin
    end;

Additional context

We would like to skip some lines that cannot easily be filtered. Internal work item: AB#545275