Study guide

5.3: Page Extensions & Page Customizations

Microsoft Dynamics 365 Business Central Developer MB-820

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Business Central Architecture & Platform Foundation

1.1 Business Central Architecture & Extensions Model 1.2 Customization Lifecycle: Cloud (SaaS) vs. On-Premises 1.3 Base Application, System Application & AppSource

2 Chapter 2: Development Environment & Configuration

2.1: Development Environment Setup: VS Code, AL: Go! Projects & Sandboxes 2.2: AL Configuration Files: app.json & launch.json Parameters 2.3: Multi-Root Workspaces & Project Dependencies

3 Chapter 3: Extension Lifecycle: Debugging, Deployment, Multilanguage & Maintenance

3.1 Debugging & Snapshot Debugging in Visual Studio Code 3.2 Extension Deployment & Schema Synchronization Modes 3.3 Multilanguage Development with XLIFF & Translation Files 3.4 Extension Maintenance, Deprecation & Breaking Changes

4 Chapter 4: Tables, Table Extensions & Data Modeling

4.1: Building Tables, Fields, Keys & Data Types 4.2: Table Extensions & Table Modifications 4.3: FlowFields, FlowFilters & Table Relations 4.4: Enums, Enum Extensions & Extensible Types

5 Chapter 5: Pages, Page Extensions & Role Centers

5.1: Page Types, Anatomy & Control Structure 5.2: Building Card, List & Document Pages 5.3: Page Extensions & Page Customizations 5.4: Role Centers, Headlines & Cue Data Modeling

6 Chapter 6: Reports & Document Generation

6.1 Report Architecture, DataItems & Dataset Design 6.2 Report Layouts: RDLC, Word, Excel & Multilanguage 6.3 Document Reports & Request Page Programming 6.4 Processing-Only Reports & Report Substitutions

7 Chapter 7: XMLports & Data Exchange

7.1 XMLport Architecture, Formats & Properties 7.2 XMLport Node Hierarchy, Triggers & Stream Manipulation

8 Chapter 8: Codeunits, Events, Triggers & Interfaces

8.1 Codeunit Types, Execution & SingleInstance Codeunits 8.2 Events, Publishers, Subscribers & Event Isolation 8.3 Interfaces, Polymorphism & Dynamic Codeunit Invocation 8.4 Installation & Upgrade Codeunits, Data Transfer & Archive

9 Chapter 9: Entitlements, Permissions & Queries

9.1 Permission Sets & Permission Set Extensions 9.2 Inherent Permissions, Inherent Entitlements & Security Scoping 9.3 Query Objects: Joins, Aggregation & Query as Report Data Source

10 Chapter 10: UI Customization, User Assistance & Onboarding

10.1 Profile Objects & Custom Page Views in AL 10.2 User Assistance: ToolTips, Teaching Tips & In-App Tours 10.3 Assisted Setup, Guided Experience & Onboarding Checklists

11 Chapter 11: Business Central Design Patterns & Data Process Model

11.1 Functional Table Types: Master Data, Supplemental & Setup Patterns 11.2 Document Standards: Header, Line, History & Journal Architectures 11.3 Data Process Model & Posting Routine Architecture

12 Chapter 12: AL Language Fundamentals, Data Types & Variables

12.1 AL Syntax, Variable Scope, Primitive & Complex Data Types 12.2 Expressions, Control Flow Statements & Built-in Functions 12.3 Access Modifiers (Public, Internal, Local) & Code Scoping

13 Chapter 13: Data Manipulation, Streams & Error Handling

13.1 Record Operations: Get, FindSet, ModifyAll & Filter Functions 13.2 Streams, File Management & TempBlob 13.3 Error Handling: ErrorInfo, TryFunctions & Collectible Errors

14 Chapter 14: Testing, Test Toolkit & Automation

14.1 Testing Architecture & the Test Toolkit 14.2 Authoring Test Codeunits & UI Handler Functions

15 Chapter 15: Telemetry, Performance Optimization & Analyzers

15.1 Telemetry Configuration & Azure Application Insights 15.2 Custom Telemetry Signals with Session.LogMessage & KQL 15.3 Performance Profiler, SetLoadFields & Query Optimization 15.4 AL Analyzers: CodeCop, AppSourceCop, UICop & PTECop

16 Chapter 16: REST Web Services & JSON in AL

16.1 HttpClient, HttpRequestMessage & REST API Consumption 16.2 JSON Processing: JsonObject, JsonArray, JsonValue & JsonToken

17 Chapter 17: API Pages, OData, Read Scale-Out & OAuth

17.1 API Pages (PageType=API), OData Web Services & REST Endpoints 17.2 Bound and Unbound OData Actions with [ServiceEnabled] 17.3 Read Scale-Out Architecture & DataAccessIntent Configuration 17.4 Microsoft Entra ID App Registrations & OAuth 2.0 Integration

5.3: Page Extensions & Page Customizations

Key Takeaways Explain This Topic AI

Page extensions (pageextension) additively augment base application or third-party pages using placement keywords (addfirst, addlast, addbefore, addafter) and rearrangement directives (movefirst, movelast, movebefore, moveafter).

The modify() keyword in page extensions allows changing properties of existing controls and actions (Visible, Enabled, Editable, Importance, ToolTip), but cannot alter underlying field data types or primary keys.

Page customizations (pagecustomization) provide role-specific UI adaptations without code; they are strictly declarative and cannot declare AL variables, global procedures, or page triggers.

Profile objects (profile) bind page customizations to specific user roles, configuring default Role Centers and targeted customized layouts without global code modifications.

Understanding the page trigger execution lifecycle is vital: OnInit and OnOpenPage run during initialization, OnAfterGetRecord fires for every row rendered in a repeater, OnAfterGetCurrRecord fires for the active cursor, and OnQueryClosePage can evaluate CloseAction to cancel page closure.

Last updated: August 2026

5.3 Page Extensions & Page Customizations

In modern Business Central development, modifying existing user interfaces is achieved without altering base Microsoft code. Developers use Page Extensions ( pageextension ) to additively introduce new fields, controls, actions, views, and AL triggers to standard pages across the entire tenant. For role-specific UI tailoring without code, developers use Page Customizations ( pagecustomization ) bound to user Profiles ( profile ). Understanding the strict architectural differences between these objects, defining custom page views, and mastering the page trigger execution lifecycle is heavily tested on the MB-820 exam.

1. Page Extensions: Additive UI and Logic Enhancement

A pageextension object targets an existing page and applies non-intrusive modifications.

Layout and Action Placement Directives

When adding controls to the layout or actions to the ribbon, AL provides four placement keywords:

addfirst(AnchorControl; ...) : Inserts the new element as the first child of the specified container.

addlast(AnchorControl; ...) : Inserts the new element as the last child of the specified container.

addbefore(AnchorControl; ...) : Inserts the new element immediately preceding the target control or action.

addafter(AnchorControl; ...) : Inserts the new element immediately following the target control or action.

Modifying Existing Controls: modify()

Existing base application controls and actions can be modified using the modify() block:

Permissible modifications: Visible , Enabled , Editable , Importance , ToolTip , Style , StyleExpr .

Restrictions: You cannot change the underlying field data type, field length, or primary key bindings.

Moving Existing Controls

Elements can be rearranged without redefining them using move keywords: movefirst() , movelast() , movebefore() , and moveafter() .

Adding Predefined Views via views Block

In page extensions targeting List pages, developers can introduce permanent, predefined filter and sort views using the views container: pageextension 50121 "Customer List Views Ext" extends "Customer List"

  • {
  • views
  • {
  • addfirst
  • {
  • view(HighBalanceCustomers)
  • {
  • Caption = 'High Balance (> 10,000)';
  • Filters = where("Balance (LCY)" = filter(> 10000));
  • OrderBy = descending("Balance (LCY)");
  • SharedLayout = true;
  • }
  • }
  • }
  • }
  • Full Page Extension Code Example pageextension 50120 "Customer Card Loyalty Ext" extends "Customer Card"
  • {
  • layout
  • {
  • // Add loyalty field immediately after General -> Name
  • addafter(Name)
  • {
  • field("Loyalty Tier Code"; Rec."Loyalty Tier Code")
  • {
  • ApplicationArea = All;
  • ToolTip = 'Specifies the customer loyalty membership tier.';
  • Importance = Promoted;
  • }
  • }
  • // Modify standard credit limit field to always be highlighted
  • modify("Credit Limit (LCY)")
  • {
  • Importance = Promoted;
  • Style = StrongAccent;
  • }
  • }
  • actions
  • {
  • addlast(processing)
  • {
  • action(RecalculateLoyaltyPoints)
  • {
  • ApplicationArea = All;
  • Caption = 'Recalculate Points';
  • Image = Refresh;
  • ToolTip = 'Recomputes loyalty points based on posted sales history.';
  • trigger OnAction()
  • var
  • LoyaltyMgmt: Codeunit "Loyalty Management";
  • begin
  • LoyaltyMgmt.UpdateCustomerPoints(Rec."No.");
  • end;
  • }
  • }
  • }
  • }

Loading diagram... Business Central Page Trigger Execution Lifecycle

2. Page Customizations vs. Page Extensions

While a pageextension applies modifications to all users globally across the tenant, a Page Customization ( pagecustomization ) applies layout alterations exclusively to a specific user Profile (Role Center persona).

Architectural Rules & Constraints of pagecustomization

Declarative Only (No Code): A pagecustomization cannot declare AL variables, custom global procedures, or page triggers ( OnOpenPage , OnAfterGetRecord , etc.). It can only contain layout and action structural modifications ( modify , move , add ).

Only Existing Fields: You can only add fields that already exist on the underlying SourceTable of the target page.

Profile Association: A page customization is inactive until referenced by a profile object via the Customizations property. pagecustomization "Sales Agent Customer Card" customizes "Customer Card"

  • {
  • layout
  • {
  • // Hide credit limit from junior sales agents
  • modify("Credit Limit (LCY)")
  • {
  • Visible = false;
  • }
  • // Move phone number to the very top of the General FastTab
  • movefirst(General; "Phone No.")
  • }
  • }
  • profile "Sales Agent"
  • {
  • Caption = 'Sales Representative';
  • RoleCenter = "Order Processor Role Center";
  • Customizations = "Sales Agent Customer Card";
  • Promoted = true;
  • Enabled = true;
  • }

3. The Runtime Execution Lifecycle of Page Triggers

Understanding when triggers execute is vital for performance optimization and bug prevention. Heavy calculations placed in the wrong trigger can cause severe UI lag across the entire tenant.

Trigger Execution Timing & Purpose Performance & Coding Guidelines

OnInit Executes once when the page is instantiated in memory before controls are created. Used to initialize local variables or determine dynamic control visibility flags. Rec is not yet loaded.

OnOpenPage Executes once when the page UI is displayed to the user. Used to set runtime filters ( SetRange ), apply security filters, or initialize singleton records.

OnAfterGetRecord Executes every time a record is fetched and rendered on the screen. On a List page with 50 displayed rows, this trigger executes 50 times . Critical Performance Hazard: Never execute heavy database queries, REST API calls, or unindexed calculations here. Used strictly for lightweight formatting (e.g., setting StyleExpr variables).

OnAfterGetCurrRecord Executes when the active cursor focus shifts to a new record. Used to calculate record-specific sub-totals, refresh contextual variables, or update header summary fields.

OnNewRecord(BelowxRec) Executes when a new blank record is initialized. Used to populate default values for new lines before user input.

OnInsertRecord(BelowxRec) Executes before committing a new record to the database from the page. Can return false to cancel insertion. Bypassed if DelayedInsert = true until focus leaves the row.

OnModifyRecord() Executes before saving a modified record to SQL. Can return false to abort modification.

OnDeleteRecord() Executes before deleting a record from the page. Can return false to abort deletion.

OnQueryClosePage(CloseAction) Executes when the user attempts to close the page. Passes CloseAction ( OK , Cancel , LookupOK , LookupCancel ). Return false to prevent the user from closing the page (e.g., if mandatory fields are missing).

OnClosePage Executes when the page successfully closes and unloads from memory. Clean up temporary files or log session telemetry.

Validating Page Dismissal: OnQueryClosePage

Developers frequently need to enforce document completeness before a user closes an editing card. The OnQueryClosePage trigger receives a CloseAction parameter indicating how the user closed the window: trigger OnQueryClosePage(CloseAction: Action): Boolean

  • begin
  • if CloseAction in [Action::OK, Action::LookupOK] then begin
  • if Rec.Status = Rec.Status::"In Progress" then begin
  • if Rec."Assigned Inspector" = '' then begin
  • Message('You must assign an inspector before completing the audit.');
  • exit(false); // Cancels page closure and leaves page open
  • end;
  • end;
  • end;
  • exit(true); // Allows page closure
  • end;