{"title":"Table extension object","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-table-ext-object/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-table-ext-object, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-table-ext-object","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"This article describes the table extension object in AL for Business Central.","date":"2024-04-17","meta":{"topic":"how-to"},"outline":[{"level":1,"title":"Table extension object","slug":"table-extension-object","at":0,"chars":3591},{"level":2,"title":"Using a table extension to add a key to the base table","slug":"using-a-table-extension-to-add-a-key-to-the-base-table","at":1237,"chars":382},{"level":2,"title":"Snippet support","slug":"snippet-support","at":1619,"chars":207},{"level":2,"title":"Properties","slug":"properties","at":1826,"chars":224},{"level":2,"title":"Add tooltips on table fields","slug":"add-tooltips-on-table-fields","at":2050,"chars":299},{"level":2,"title":"Table extension syntax","slug":"table-extension-syntax","at":2349,"chars":192},{"level":2,"title":"Table extension example","slug":"table-extension-example","at":2541,"chars":818},{"level":2,"title":"Related information","slug":"related-information","at":3359,"chars":232}],"text":"# Table extension object\nThe table extension object allows you to add extra fields or to change some properties on a table provided by Business Central. In this way, you can add data to the same table and treat it as a single table. For example, you might want to create a table extension for a retail winter sports store. In your solution you want to have ShoeSize as an extra field on the customer table. Adding this as an extension allows you to write code for the customer record and also include values for the ShoeSize.\nAlong with defining other fields, the table extension is where you write trigger code for your extra fields.\nWhen developing a solution for Business Central, you can follow the code layout for a table extension as shown in the example below.\n> IMPORTANT\n> Only tables with the properties/devenv-extensible-property set to true can be extended.\n> NOTE\n> Extension objects can have a name with a maximum length of 30 characters.\n> IMPORTANT\n> System and virtual tables cannot be extended. System tables are created in the ID range of 2.000.000.000 and above. For more information about object ranges, see devenv-object-ranges.\n> IMPORTANT\n> Extending tables from Dynamics 365 for Sales isn't currently supported.\n## Using a table extension to add a key to the base table\nJust like in the table object, you can define keys for fields added in the table extension. But you can also add keys for fields that only exist on the table you extend, in case you want to extend the keys provided in the base table definition. See devenv-table-keys for examples on how to define keys in a table extension.\n## Snippet support\nTyping the shortcut ttableext creates the basic layout for a table extension object when using the AL Language extension for Microsoft Dynamics 365 Business Central in Visual Studio Code.\n## Properties\nUsing a table extension allows you to overwrite some properties on fields in the base table. For a list of Table properties, see Table and table extension properties<properties/devenv-table-property-overview>.\n## Add tooltips on table fields\nStarting in Business Central 2024 release wave 1, you can define tooltips on table fields. When a tooltip is defined on a table field, any page that uses the field automatically inherits the tooltip.\nSee Add tooltips to table and page fields<devenv-adding-tooltips>.\n## Table extension syntax\n```al\ntableextension Id MyExtension extends MyTargetTable\n{\n    fields\n    {\n        // Add changes to table fields here\n    }\n\n    var\n        myInt: Integer;\n}\n```\n## Table extension example\nThis table extension object extends the Customer table object by adding a field ShoeSize, with ID 50116 and the data type Integer. It also contains a procedure to check if the ShoeSize field is filled in.\n```al\ntableextension 50115 RetailWinterSportsStore extends Customer\n{\n    fields\n    {\n        field(50116;ShoeSize;Integer)\n        {\n            trigger OnValidate();\n            begin\n                if (rec.ShoeSize < 0) then\n                begin\n                   message('Shoe size not valid: %1', rec.ShoeSize);\n                end;\n            end;\n        }\n    }\n\n    procedure HasShoeSize() : Boolean\n    begin\n        exit(ShoeSize <> 0);\n    end;\n\n    trigger OnBeforeInsert();\n    begin\n        if not HasShoeSize then\n            ShoeSize := Random(42);\n    end;\n}\n```\n## Related information\nAL development environment<devenv-reference-overview>\ndevenv-tables-overview\ndevenv-table-object\nTable, table fields, and table extension properties<properties/devenv-table-property-overview>\ndevenv-table-keys"}