Page Extensions in Business Central — Complete Practical Guide
Page extensions are one of the most useful AL development tools. They let you add fields, actions and other UI changes to an existing Business Central page without modifying the base application.
What is a page extension?
A pageextension object extends an existing page. For example, if the standard Customer Card already provides most of the functionality you need, you can add your own field or action through an extension.
Basic page extension syntax
pageextension 50100 MyCustomerCardExt extends "Customer Card"
{
layout
{
addlast(General)
{
field("My Field"; Rec."No.")
{
ApplicationArea = All;
}
}
}
}
The object ID must be unique in your extension. The page name after extends identifies the existing page you want to customize.
Adding a field
You can place a field into an existing page area by using layout modification keywords such as addfirst, addlast, addbefore and addafter.
layout
{
addlast(General)
{
field("Customer No. Copy"; Rec."No.")
{
ApplicationArea = All;
ToolTip = 'Shows the customer number.';
}
}
}
Adding an action
Actions let users run functionality directly from a page. A common pattern is to add an action and call a codeunit or page.
actions
{
addlast(Processing)
{
action("My Action")
{
ApplicationArea = All;
Caption = 'My Action';
ToolTip = 'Runs a custom Business Central action.';
trigger OnAction()
begin
Message('Dynexal action executed.');
end;
}
}
}
Using a page extension in a real project
Imagine an e-commerce integration where you want to show an external order ID on the Sales Order page. The clean approach is to add the field through a table extension and then expose it through a page extension.
pageextension 50101 EcomSalesOrderExt extends "Sales Order"
{
layout
{
addlast(General)
{
field("External Order ID"; Rec."External Order ID")
{
ApplicationArea = All;
ToolTip = 'Shows the order ID from the external e-commerce system.';
}
}
}
}
This separates the data model from the user interface: the table extension owns the field, while the page extension controls where users see it.
Common mistakes
- Using an anchor name that does not exist on the target page.
- Forgetting
ApplicationAreawhen it is required by the page setup. - Trying to add a field that does not exist on the page's source table.
- Using the wrong page name in the
extendsdeclaration. - Putting too much business logic directly inside
OnAction()instead of moving reusable logic to a codeunit. - Not testing the extension after a Business Central application update.
Page extension vs. modifying the standard page
In modern Business Central development, extensions are the normal way to customize the application. Keeping your custom logic and UI changes in your own extension makes the solution easier to maintain and upgrade.
What should you learn next?
- Table extensions and fields.
- Page extensions and actions.
- Codeunits and events.
- Reports and RDLC layouts.
- APIs and external integrations.
- Testing, debugging and deployment.
For the fundamentals, review AL Tables in Business Central and Creating List and Card Pages in AL.