ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 5633 "FA Jnl.-Post Batch" - OnCodeBeforeCommit

Open ReneZiel opened this issue 3 years ago • 3 comments

Hello, can you please add a new Event OnCodeBeforeCommit in codeunit 5633 "FA Jnl.-Post Batch"? The event is called 3 times.

    local procedure "Code"()
    var
        UpdateAnalysisView: Codeunit "Update Analysis View";
        GenJnlPostPreview: Codeunit "Gen. Jnl.-Post Preview";
        IsHandled: Boolean;
    begin
        with FAJnlLine do begin
            SetRange("Journal Template Name", "Journal Template Name");
            SetRange("Journal Batch Name", "Journal Batch Name");
            OnCodeOnBeforeLockTable(FAJnlLine);
            LockTable();

            FAJnlTemplate.Get("Journal Template Name");
            FAJnlBatch.Get("Journal Template Name", "Journal Batch Name");

            if FAJnlTemplate.Recurring then begin
                SetRange("FA Posting Date", 0D, WorkDate());
                SetFilter("Expiration Date", '%1 | %2..', 0D, WorkDate());
            end;

            if not Find('=><') then begin
                if PreviewMode then
                    GenJnlPostPreview.ThrowError();
                "Line No." := 0;
                IsHandled := false;
                OnCodeBeforeCommit(FAJnlLine, IsHandled);
                if not IsHandled then
                    Commit();
                exit;
            end;
.
.
.
            OnBeforeCommit(FARegNo);

            if PreviewMode then
                GenJnlPostPreview.ThrowError();

            IsHandled := false;
            OnCodeBeforeCommit(FAJnlLine, IsHandled);
            if not IsHandled then
                Commit();
            Clear(FAJnlCheckLine);
            Clear(FAJnlPostLine);
        end;
        UpdateAnalysisView.UpdateAll(0, true);
        IsHandled := false;
        OnCodeBeforeCommit(FAJnlLine, IsHandled);
        if not IsHandled then
            Commit();
    end;
    [IntegrationEvent(false, false)]
    local procedure OnCodeBeforeCommit(var FAJnlLine: Record "FA Journal Line"; var IsHandled: Boolean)
    begin
    end;

ReneZiel avatar Aug 01 '23 06:08 ReneZiel

Hello @ReneZiel Maybe here is better to add global variable SuppressCommit and global procedure to set value. Should be possible for you to access that global procedure?

AleksandricMarko avatar Aug 01 '23 10:08 AleksandricMarko

Hello @AleksandricMarko As suggested, we added a global variable SuppressCommit. But i modified issue #24277 today with a SuppressCommit variable. The change required in #24278 is no longer required. We can't use a global function to set SuppressCommit because the codeunit isn't called from our own object but from another Microsoft codeunit.

ReneZiel avatar Aug 02 '23 10:08 ReneZiel

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: 11863.

JesperSchulz avatar Aug 19 '23 18:08 JesperSchulz