[Event Request] Codeunit 370 "Bank Acc. Reconciliation Post".FinalizePost #27940
Open
Description
Describe the request
Please add new event
local procedure FinalizePost(BankAccRecon: Record "Bank Acc. Reconciliation")
var
BankAccReconLine: Record "Bank Acc. Reconciliation Line";
AppliedPmtEntry: Record "Applied Payment Entry";
CreationDateTime: DateTime;
MatchedWithAI: Boolean;
LineCount: Integer;
TelemetryCategories: Dictionary of [Text, Text];
DurationUntilPosting: BigInteger;
//--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:BEGIN
IsHandled: Boolean;
//--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:END
begin
if PreviewMode then
exit;
OnBeforeFinalizePost(BankAccRecon);
CreationDateTime := BankAccRecon.SystemCreatedAt;
MatchedWithAI := AIMatchProposalsExist(BankAccRecon);
//--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:BEGIN
IsHandled := false;
OnFinalizePostOnBeforeLineExist(BankAccRecon, BankAccReconLine, AppliedPmtEntry, LineCount, IsHandled);
if not IsHandled then
//--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:END
if BankAccReconLine.LinesExist(BankAccRecon) then
repeat
AppliedPmtEntry.FilterAppliedPmtEntry(BankAccReconLine);
AppliedPmtEntry.DeleteAll();
BankAccReconLine.Delete();
BankAccReconLine.ClearDataExchEntries();
LineCount += 1;
until BankAccReconLine.Next() = 0;
BankAccRecon.Find();
//----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:BEGIN
IsHandled := false;
OnFinalizePostOnBeforeDeleteBankAccReconciliation(BankAccRecon, IsHandled);
if not IsHandled then
//----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:END
BankAccRecon.Delete();
TelemetryCategories.Add('Category', BankAccountRecCategoryLbl);
TelemetryCategories.Add('MatchedWithAI', Format(MatchedWithAI, 0, 9));
TelemetryCategories.Add('NumberOfLines', Format(LineCount));
if TryCalculateDurationToPost(DurationUntilPosting, CreationDateTime) then
Session.LogMessage('0000LHY', Format(DurationUntilPosting), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, TelemetryCategories);
OnAfterFinalizePost(BankAccRecon);
end;
//--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:BEGIN
[IntegrationEvent(true, false)]
local procedure OnFinalizePostOnBeforeLineExist(BankAccRecon: Record "Bank Acc. Reconciliation"; var BankAccReconLine: Record "Bank Acc. Reconciliation Line"; var AppliedPmtEntry: Record "Applied Payment Entry"; var LineCount: Integer; var IsHandled: Boolean)
begin
end;
//--------------------------------------------------------------OnFinalizePostOnBeforeLineExist:END
//----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:BEGIN
[IntegrationEvent(true, false)]
local procedure OnFinalizePostOnBeforeDeleteBankAccReconciliation(BankAccRecon: Record "Bank Acc. Reconciliation"; var IsHandled: Boolean)
begin
end;
//----------------------------------------------------OnFinalizePostOnBeforeDeleteBankAccRecon:END
Additional context
We need option to keep BankAccRecon after post.
Internal work item: AB#562597