Altering the UI (PageExtension)
Modification of the ERP visual layer to show new fields, hide elements, and alter the layout using AL.
To complete the development cycle of a new feature, once the database has been modified, we must intervene in the presentation layer.
The pageextension object allows us to inject our new fields into existing screens, move site elements, and even hide (modify the visibility of) columns that generate “visual noise” for the user.
1. The Anchoring System (Layout Modifiers)
Sección titulada «1. El Sistema de Anclaje (Modificadores de Layout)»Unlike traditional web pages based on pure HTML, Business Central pages are a hierarchical tree of metadata. To insert our field, we must use spatial modifiers (“Anchors”) to tell the system exactly where to place it relative to an existing standard field.
The available modifiers are:
addbefore(CampoDestino): Inserts it just to the left (or above).addafter(CampoDestino): Inserts it just to the right (or below).addfirst(GrupoDestino): Inserts it as the first element of a container.addlast(GrupoDestino): Inserts it as the last element of a container.moveafter(CampoDestino, MiCampo): To reorder existing fields.
2. Development: Injecting our field into the UI
Sección titulada «2. Desarrollo: Inyectando nuestro campo en la UI»Following our “End Supplier” scenario (created in the previous module in table 121), we must now display it. Since we have identified that the company uses two different windows to view this table, we must perform two independent pageextension.
Case 1: Extension on the Microsoft Standard Page
Sección titulada «Caso 1: Extensión sobre la Página Estándar de Microsoft»The standard page that shows the receipt lines is 528 (“Posted Purchase Rcpt. Subform”). We are going to place our field just to the right of the item description.
File: Pag-Ext50100.PurchRcptLinesExt.al
// 1. Declaración y enlace a la página originalpageextension 50100 "Portelcore PurchRcptLines Ext" extends "Posted Purchase Rcpt. Subform"{ layout { // 2. Punto de anclaje visual (Inmediatamente después de "Description") addafter(Description) { // 3. Declaración del campo a mostrar (Rec es el puntero al registro actual) field("Proveedor Final"; Rec."Proveedor Final") { // ApplicationArea es obligatorio. Si no se pone, el campo queda invisible por seguridad. ApplicationArea = All;
// Texto de ayuda (Hover) para guiar al usuario ToolTip = 'Indica el nombre del fabricante original de la materia prima (Analítica DevSecOps).';
// Propiedades de formato (opcionales) ShowMandatory = true; // Pone un asterisco rojo (aunque no fuerza el error en la base de datos)
// Nota arquitectónica: En páginas de histórico (Albaranes Registrados), // por norma general los campos deberían ser de solo lectura. Editable = false; } } }}Case 2: Extension on an Internal Custom Page
Sección titulada «Caso 2: Extensión sobre una Página Personalizada Interna»We have detected that the warehouse team does not use page 528, but rather a simplified one created internally called Lineas albaran compra (Page 50017). For them, the field must be very visible and located next to the quantity.
File: Pag-Ext50101.CustomPurchRcptLinesExt.al
pageextension 50101 "Portelcore CustomRcptLines Ext" extends "Lineas albaran compra"{ layout { addafter(Quantity) { field("Proveedor Final"; Rec."Proveedor Final") { ApplicationArea = All; ToolTip = 'Fabricante de origen.';
// Destaque visual: Pone el texto en negrita Style = Strong; } } }}3. Data Lifecycle Summary
Sección titulada «3. Resumen del Ciclo de Vida del Dato»With this final step, we have completed the data “Triforce” in a modern DevSecOps environment:
- Persistence (Backend): We create the physical space in SQL via
tableextension. The underlying system begins to operate with it. - Interaction (Frontend): We provide humans with read/write points via
pageextensionin all required interfaces. - Analysis (Data Pipeline): We invisibly and at high speed export that same data via
Query APIsto our Business Intelligence (Power BI) repositories.
4. UI and User Experience (UX) Checklist
Sección titulada «4. Checklist de UI y Experiencia de Usuario (UX)»- ✓ ApplicationArea:
ApplicationArea = Allproperty explicitly defined in each injected field to prevent the engine from hiding it. - ✓ Accessibility: Inclusion of descriptive ToolTips in all visual controls.
- ✓ Business Restrictions:
Editable = falseproperty implemented on history or read-only pages to ensure the immutability of accounting data.

