table 273 "Bank Acc. Reconciliation" : Error in OnDelete trigger for ResetStatementFields (NA)
Please include the following with each issue:
1. Describe the bug On the table 273 "Bank Acc. Reconciliation" in the OnDelete trigger two procedure is called ResetStatementFields.
trigger OnDelete()
var
BankAccountLedgerEntry: Record "Bank Account Ledger Entry";
CheckLedgerEntry: Record "Check Ledger Entry";
begin
if BankAccReconLine.LinesExist(Rec) then
BankAccReconLine.DeleteAll(true);
**_BankAccountLedgerEntry.ResetStatementFields("Bank Account No.", "Statement No.");_**
**_CheckLedgerEntry.ResetStatementFields("Bank Account No.", "Statement No.");_**
end;
both calls are made with out consider the field value of "Statement Type". (Code found only in a BC NA)
This means if a Bank Statement ("Statement Type":"Bank Reconciliation") is posted with following keys, Bank Account := B010, Statement no. := 1, records in table 271 "Bank Account Ledger Entry" get the values of Bank Account (B010) and Statement No. (1)
Then if you make a Payment Recon. Journal (Also table 273 "Bank Acc. Reconciliation") and this Payment Recon. Journal also get the values Bank Account := B010, Statement no. := 1. (Statement No. is comming from Table Bank Account, either from field "Last Statement No." (Bank Account reconciliation) or "Last Payment Statement No." (Payment Reconciliation)
Then you delete the Payment Recon. Journal (table 273 "Bank Acc. Reconciliation") which triggers OnDelete. This then call ResetStatementFields with parm, "Bank Account No." (B010), "Statement No." (1), which then reopen the records in table 271 "Bank Account Ledger Entry".
2. To Reproduce Steps to reproduce the behavior:
-
Make sure you are in a BC NA
-
Go to 'Bank Account and create a new bank account. (Leave fields "Last Statement No." and "Last Payment Statement No." blank)
-
Go to bank account Reconciliation and create a new bank Account Reconciliation, You will get Statement No. := 1 (Comming from "Bank Account"."Last Statement No.")
-
Reconcile/Post the bank Account Reconciliation journal with some ledger entries in your system.
-
Go to Bank Account and check that the Bank Account Ledger Entries are closed.
-
Go to Payment Reconciliation Journal, create a new journal for the same bank account. You will get Statement No. := 1 (Comming from "Bank Account"."Last Payment Statement No." )
-
Delete the Payment Reconciliation Journal again.
-
Go to Bank Account and check that the Bank Account Ledger Entries, now they are suddenly reopened.
trigger OnDelete()
var
BankAccountLedgerEntry: Record "Bank Account Ledger Entry";
CheckLedgerEntry: Record "Check Ledger Entry";
begin
if BankAccReconLine.LinesExist(Rec) then
BankAccReconLine.DeleteAll(true);
BankAccountLedgerEntry.ResetStatementFields("Bank Account No.", "Statement No.");
CheckLedgerEntry.ResetStatementFields("Bank Account No.", "Statement No.");
end;
Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.
3. Expected behavior That the Bank Account Ledger Entries would be kept closed, when a Payment Reconciliation Journal is deleted.
4. Actual behavior A clear and concise description of what happened accompanied by images, animations, or a link to a video showing the issue occurring
5. Versions:
- AL Language: NA
- Visual Studio Code:
- Business Central: Found in 18.3.27240.27381
- List of Visual Studio Code extensions that you have installed:
Final Checklist
Please remember to do the following:
-
[ ] Search the issue repository to ensure you are reporting a new issue
-
[ ] Reproduce the issue after disabling all extensions except the AL Language extension
-
[ ] Simplify your code around the issue to better isolate the problem
Thank you for reaching out. Your request could be reporting a product bug not related to the AL application extensibility. Please reach out to the relevant support channels:
- For collaboration in preview or beta versions of AL Language in Visual Studio Code (aka ModernDev), use GitHub (https://github.com/microsoft/al).
- For Microsoft partners, for versions already in general availability and supported, file requests through Microsoft Partnersource (https://mbs.microsoft.com/partnersource/).
- For ISVs/VARs who have discovered a bug in a in preview or beta version, use MS Collaborate (https://docs.microsoft.com/en-us/collaborate/).
- For Business Central customers who have issues or found bugs, please contact your Microsoft partner.
- For the new features please submit a product suggestion on https://aka.ms/bcideas