← Back to TutorialsAL DEVELOPMENT

AL Tables in Business Central: Complete Beginner Guide

Dynexal • Beginner Guide • 10 min read

Tables are one of the most important building blocks in Business Central. They define how business data is stored and are the foundation for pages, reports, APIs and many other AL objects.

In this guide: table structure, fields, keys, a practical table example, table extensions and common mistakes.

What is a table in Business Central?

A Business Central table defines a set of fields that represent business data. For example, a custom application might need to store support tickets, project requests or external order references. The table provides the data structure that other objects can work with.

Create a simple AL table

Here is a small example of a custom table for storing project information:

table 50100 "Dynexal Project"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; "Project No."; Code[20])
        {
            Caption = 'Project No.';
        }
        field(2; "Project Name"; Text[100])
        {
            Caption = 'Project Name';
        }
        field(3; "Status"; Option)
        {
            Caption = 'Status';
            OptionMembers = Open,"In Progress",Completed;
        }
    }

    keys
    {
        key(PK; "Project No.")
        {
            Clustered = true;
        }
    }
}

Understanding the main sections

Fields: choosing the right data type

AL provides data types such as Code, Text, Integer, Decimal, Date, Boolean, Enum and more. Choose the type based on the business meaning of the value rather than simply how it looks on screen.

Primary keys

A primary key identifies a record. In the example above, Project No. is used as the primary key. A good key should uniquely identify a record and fit the business process.

Table extensions

When you need to add fields to an existing standard Business Central table, use a table extension instead of modifying the base table.

tableextension 50101 CustomerExt extends Customer
{
    fields
    {
        field(50100; "Dynexal Reference"; Code[30])
        {
            Caption = 'Dynexal Reference';
            DataClassification = CustomerContent;
        }
    }
}

Common beginner mistakes

  1. Using a data type that does not match the business requirement.
  2. Creating a key without considering how records will be searched.
  3. Changing standard tables directly instead of using extensions.
  4. Ignoring data classification for new fields.
  5. Building a table without considering how pages, reports and integrations will consume the data.

What should you learn next?

Once you understand tables, the natural next step is to build a List Page and Card Page over your table. Then learn List and Card Pages in AL, page extensions, actions, validation, codeunits and events.

← Explore more Dynexal tutorials