microsoft / microsoft/BCApps

[Bug]: [BE] GetCurrencyCode on Coda Statement throws Error

Open Beginner friendly
#11,605 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Team: Finance
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Describe the issue

BE Localization

table 2000040 "CODA Statement"

The Statement fields use an AutoFormatExpression that retrieves a Currency Code from the related BankAccount using a .Get() without checking if the BankAccount exists.

This causes an issue in several scenarios:

  1. The AutoFormatExpression triggers with an empty record after a Page.Run() or when opening the table directly through URL.
  2. Coda Statements are not deleted when the related Bank Account is deleted, so these Coda Statements will always throw an error when trying to view them.
      field(3; "Statement Ending Balance"; Decimal)
       {
           AutoFormatType = 1;
           AutoFormatExpression = GetCurrencyCode();
           Caption = 'Statement Ending Balance';
       }
       field(5; "Balance Last Statement"; Decimal)
       {
           AutoFormatType = 1;
           AutoFormatExpression = GetCurrencyCode();
           Caption = 'Balance Last Statement';
       }
   local procedure GetCurrencyCode(): Code[10]
   begin
       BankAcc.Get("Bank Account No.");
       exit(BankAcc."Currency Code");
   end;
Expected behavior

The GetCurrencyCode() procedure should not throw an error if the Bank Account is not found.
The procedure should return an empty string.

Steps to reproduce

On any BE environment >= 28.4:
Open the Coda Statement table directly by appending to the URL ?table=2000040

An Error occurs:

Error message:
The Bank Account does not exist. Identification fields and values: No.=''

Internal session ID:
c4fd5ea8-5a92-4989-9e11-007ed4eaa003

Application Insights session ID:
34aea698-d39b-432a-863f-0769af7e99d0

Client activity id:
a8cbc15d-83ff-4952-a543-e1b39e87a522

Time stamp on error:
2026-09-18T09:38:46.6183419Z

User telemetry id:
9b0acab0-dd63-43ce-b5a7-3baf7e9b2a8a

AL call stack:
"CODA Statement"(Table 2000040).GetCurrencyCode line 2 - Base Application by Microsoft version 28.5.54151.54646

Additional context

1 issue was already addressed in BE 28.3 as hotfix 636256, but it doesn't cover the scenarios described here

I will provide a fix for a bug
  • I will provide a fix for a bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with table 2000040, "CODA Statement", and its GetCurrencyCode procedure. Reproduce the issue by opening the table with ?table=2000040, then verify behavior when the Bank Account is missing or the record is empty. Done means the procedure no longer throws an error and returns an empty string when no Bank Account is found.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.