ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] table 81 "Gen. Journal Line" - OnBeforeRemoveIncomingDocumentEntryNo

Open DanielGoehler opened this issue 2 years ago • 9 comments

Describe the request

Hi, please add the Event OnBeforeRemoveIncomingDocumentEntryNo:

table 81 "Gen. Journal Line"
{
[..]
    trigger OnDelete()
    var
        GenJournalBatch: Record "Gen. Journal Batch";
        GenJournalLine: Record "Gen. Journal Line";
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeOnDelete(Rec, IsHandled);
        if IsHandled then
            exit;

        CheckJobQueueStatus(Rec);
        ApprovalsMgmt.PreventDeletingRecordWithOpenApprovalEntry(Rec);

        // Lines are deleted 1 by 1, this actually check if this is the last line in the General journal Bach
        GenJournalLine.SetRange("Journal Template Name", "Journal Template Name");
        GenJournalLine.SetRange("Journal Batch Name", "Journal Batch Name");
        if GenJournalLine.Count = 1 then
            if GenJournalBatch.Get(Rec."Journal Template Name", Rec."Journal Batch Name") then
                ApprovalsMgmt.PreventDeletingRecordWithOpenApprovalEntry(GenJournalBatch);

        TestField("Check Printed", false);

        IsHandled := false;
        OnDeleteOnBeforeClearCustVendApplnEntry(Rec, GenJournalBatch, GenJnlAlloc, IsHandled);
        if not IsHandled then begin
            ClearCustVendApplnEntry();
            ClearAppliedGenJnlLine();
            DeleteRelatedPaymentFileErrors();
            ClearDataExchangeEntries(false);

            GenJnlAlloc.SetRange("Journal Template Name", "Journal Template Name");
            GenJnlAlloc.SetRange("Journal Batch Name", "Journal Batch Name");
            GenJnlAlloc.SetRange("Journal Line No.", "Line No.");
            if not GenJnlAlloc.IsEmpty() then
                GenJnlAlloc.DeleteAll();
        end;

        DeferralUtilities.DeferralCodeOnDelete(
            DeferralDocType::"G/L".AsInteger(),
            "Journal Template Name", "Journal Batch Name", 0, '', "Line No.");

        //++++++++++++++++++++++++++++++++++++++++++++
        IsHandled := false;
        OnBeforeRemoveIncomingDocumentEntryNo(Rec, IsHandled);
        if not IsHandled then
        //--------------------------------------------
          Rec.Validate("Incoming Document Entry No.", 0);

        RecallSetDimFiltersNotification();
        DeleteGenJnlDimFilters();
    end;
[..]
    //++++++++++++++++++++++++++++++++++++++++++++
    [IntegrationEvent(false, false)]
    local procedure OnBeforeRemoveIncomingDocumentEntryNo(GenJournalLine: Record "Gen. Journal Line"; var IsHandled: Boolean)
    begin
    end;
    //--------------------------------------------
[..]

Additional context

Currently Business Central does not have Multiple Journal Line Support for Incoming Documents. In order to achieve this, we need this event to correctly handle the Business Central standard business logic. Internal work item: AB#535511

DanielGoehler avatar May 15 '24 13:05 DanielGoehler

Correct solution is to solve the ideas ticket, and not fix it short term with this IsHandled event. Please reach out to PM for more information about teams capacity to pick up that functionality request.

Groenbech96 avatar Sep 23 '24 13:09 Groenbech96

@Groenbech96 My idea is linked in the text above. I reached out to PM and received the following response:

Thank you for your feedback. We are not considering the suggestion at this time due to the following reason: As the e-invoicing becomes mandated in majority of countries (if not yet), we are strategically focused to continue investment in enriching new E-Documents framework, so if similar requests exist they can be required in the context of E-Documents framework.

Sincerely, Aleksandar Totovic PM, Microsoft

I haven’t received a solution from the PM, nor have I received the event request. Is the goal here to frustrate me?

DanielGoehler avatar Sep 23 '24 15:09 DanielGoehler

Yea, so it is recorded and an effort has been created internally for the team. When it gets picked up depends on team priority. We have limited resources 😊

Sorry if that was unclear from above.

Groenbech96 avatar Sep 23 '24 15:09 Groenbech96

Ok, thanks!

DanielGoehler avatar Sep 23 '24 16:09 DanielGoehler

@Groenbech96 Any update here?

DanielGoehler avatar Mar 19 '25 15:03 DanielGoehler

Hi Daniel, sorry for the big delay getting back to you on this and I apologize for not (yet) having an answer for you. We have been making a lot of changes in this past period into Incoming Documents and E-Documents, so the backlog is still quite in flux. I do not have full clarity if we have capacity to implement the BC Idea right now, and I am a bit reticent to just introduce an IsHandled event pattern in the middle of General Journal Line / Post Batch.

Let me do something: I will follow up with the PMs in the area to clarify if the current plans include support for Multiple Journal Lines and, if not, I will discuss with my engineers what we can do to unblock you. I will get back to you with more info the week after Easter.

Does that work?

Aleyenda avatar Apr 07 '25 10:04 Aleyenda

Yes, that would be nice.

DanielGoehler avatar Apr 07 '25 11:04 DanielGoehler

@DanielGoehler Can i suggest that your implementation is contributed as a pull request on ALAppExtensions, instead of the IsHandled event?

This way we both get a win 🥇

Groenbech96 avatar Apr 15 '25 15:04 Groenbech96

@Groenbech96 Sure! I've created an issue on BusinessCentralApps: https://github.com/microsoft/BusinessCentralApps/issues/1367
Once it's approved, I'll provide the implementation. This event is no longer need on my end.

DanielGoehler avatar Apr 18 '25 08:04 DanielGoehler