Skip to content

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

Description

@Warren-BR

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ApprovedThe issue is approvedTeam: FinanceGitHub request for Finance area

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions