web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Issue with Alphanumeric Field Naming in API Page for "G/L Account" in Business Central

(1) ShareShare
ReportReport
Posted on by 3
Hi All,
I am experiencing a challenge while developing a custom API page in AL for Business Central. My API page is designed to interact with the /G/L Account/ table, specifically to import records.

Issue: I am using the field /No./ from the /G/L Account/ table as the primary key in my API page. However, I encounter a conflict between two requirements:
ALAL0528 Warning: Fields in API pages must be alphanumeric.
ALAL0615 Warning: Fields specified in ODataKeyFields must be used as the source expression in a page control.

This presents a problem because the field /No./ is not alphanumeric, but it needs to be directly used to satisfy the ODataKeyFields requirement. I attempted using an alphanumeric alias in the layout while maintaining the original field name in the ODataKeyFields, but this leads to the ALAL0615 warning.
 

Could you please provide guidance or a solution on how to handle this situation? I need to ensure that my API page adheres to the best practices and requirements of AL development while correctly interfacing with the /G/L Account/ table.

sample code where I tried to use an alias as explained.
 
page 50101 /GL Account Import API/
{
    PageType = API;
    Caption = 'GL Account API';
    UsageCategory = Administration;
    APIPublisher = 'myCompany';
    APIGroup = 'myGroup';
    APIVersion = 'v1.0';
    EntityName = 'glaccount';
    EntitySetName = 'glaccounts';
    SourceTable = /G/L Account/;
    DelayedInsert = true;
    ODataKeyFields = /No./;
    AccessByPermission = TableData /G/L Account/ = rimd;
 
    layout
    {
        area(content)
        {
            field(AccountNo; /No./)
            {
                Caption = 'Account No';
            }
        }
    }
 
    trigger OnInsertRecord(BelowxRec: Boolean): Boolean
    var
        GLAccount: Record /G/L Account/;
    begin
        GLAccount.Init();
        GLAccount./No./ := AccountNo;
 
        // Set other fields as needed
        GLAccount.Insert();
    end;
 
    trigger OnModifyRecord(): Boolean
    begin
         // Handle modifications if necessary
    end;
 
    trigger OnDeleteRecord(): Boolean
    begin
         // Handle deletions if necessary
    end;
}
 
Does anyone knows how to proceed?
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at
    It is recommended that you do not use No., but use the system id. This is also standard practice.
    The following is the standard API of G/L Account. Hope it can give you some reference.
     
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,468

#2
YUN ZHU Profile Picture

YUN ZHU 923 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans