[Event Request] table 81 "Gen. Journal Line" - OnBeforeRemoveIncomingDocumentEntryNo
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
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 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?
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.
Ok, thanks!
@Groenbech96 Any update here?
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?
Yes, that would be nice.
@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 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.