{"title":"Page extension object","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-page-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-page-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-page-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":"Extend page objects with page extension objects in AL for Business Central.","date":"2024-11-13","meta":{"topic":"how-to"},"outline":[{"level":1,"title":"Page extension object","slug":"page-extension-object","at":0,"chars":9254},{"level":2,"title":"Snippet support","slug":"snippet-support","at":979,"chars":418},{"level":2,"title":"Views","slug":"views","at":1397,"chars":269},{"level":2,"title":"Add tooltips on page fields","slug":"add-tooltips-on-page-fields","at":1666,"chars":330},{"level":2,"title":"Using keywords to place actions and controls","slug":"using-keywords-to-place-actions-and-controls","at":1996,"chars":3226},{"level":3,"title":"Example","slug":"example","at":3077,"chars":2145},{"level":2,"title":"Page extension examples","slug":"page-extension-examples","at":5222,"chars":3682},{"level":2,"title":"Related information","slug":"related-information","at":8904,"chars":350}],"text":"# Page extension object\nThe page extension object extends a Dynamics 365 Business Central page object and adds or overrides the functionality.\nThe structure of a page is hierarchical and breaks down into three sections. The first block contains metadata for the overall page; the type of the page and the source table it is showing data from. The next section; the layout, describes the visual parts on the page. The final section details the actions that are published on the page.\nLearn more about Page and Page Extension objects in devenv-pages-overview.\n> IMPORTANT\n> Only pages 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> A page of type API page can't be extended by creating a page extension object. Instead, create a new API page by adding a new devenv-page-object.\n> NOTE\n> Modifying actions in Cue groups on page extensions isn't supported.\n## Snippet support\nTyping the shortcut tpageext will create the basic layout for a page extension object when using the AL Language extension for Microsoft Dynamics 365 Business Central in Visual Studio Code.\n> TIP\n> Use Ctrl+Space to trigger IntelliSense and get assistance on code completion, parameter info, quick info, and member lists. For more information about snippets, see Syntax and snippets<devenv-syntax>.\n## Views\nViews in Dynamics 365 Business Central are used on list pages to define a different view of the data on a given page. Views can be defined for devenv-page-object, Page extensions<devenv-page-ext-object>, and devenv-page-customization-object. See devenv-views.\n## Add tooltips on page 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.\nLearn more about adding tooltips in Add tooltips to table and page fields<devenv-adding-tooltips>.\n## Using keywords to place actions and controls\nYou can use the following keywords in the layout section to place and move fields and groups on the page extension. Similarly, in the actions section, you use these keywords to place actions in the ribbon.\nKeywords|Syntax|Applies to\naddfirst|`addfirst(Anchor)`|Anchor: areas and groups\naddlast|`addlast(Anchor)`|Anchor: areas and groups\naddafter|`addafter(Anchor)`|Anchor: controls, actions, and groups\naddbefore|`addbefore(Anchor)`|Anchor: controls, actions, and groups\nmovefirst|`movefirst(Anchor; Target1, Target2)`|Anchor: area, group <br>Target: list of actions or list of controls\nmovelast|`movelast(Anchor; Target1, Target2)`|Anchor: area, group <br>Target: list of actions or list of controls\nmoveafter|`moveafter(Anchor; Target1, Target2)`|Anchor: controls, actions, and groups <br>Target: list of actions or list of controls\nmovebefore|`movebefore(Anchor; Target1, Target2)`|Anchor: controls, actions, and groups <br>Target: list of actions or list of controls\nmodify|`modify(Target)`|Target: controls, actions, and groups\n### Example\nTo modify the existing fields and groups on a page, use the modify keyword. See the code snippet below for addlast, modify and action syntax. In the following example, the actions section creates a new group in the ribbon and places it last in the Creation group. The group contains an action that displays a message when the user chooses it. The layout section adds a new field control ShoeSize to the General group on the page. The field control is added as the last control in the group using the addlast method. The example also illustrates how to modify the caption of an existing field on the page.\n```al\npageextension 70000020 CustomerCardExtension extends \"Customer Card\"\n{\n    layout\n    {\n        // Adding a new control field 'ShoeSize' in the group 'General'\n        addlast(General)\n        {\n            field(\"Shoe Size\"; ShoeSize)\n            {\n                Caption = 'Shoe size';\n\n                trigger OnValidate();\n                begin\n                    if (ShoeSize < 10) then\n                        Error('Feet too small');\n                end;\n            }\n        }\n\n        // Modifying the caption of the field 'Address'\n        modify(\"Address 2\")\n        {\n            Caption = 'New Address 2';\n        }\n\n        // Moving the two fields 'CreditLimit' and 'CalcCreditLimitLCYExpendedPct'\n        // to be the first ones in the 'Balance' group.\n        movefirst(Balance; CreditLimit, CalcCreditLimitLCYExpendedPct)\n    }\n    actions\n    {\n        // Adding a new action group 'MyNewActionGroup' in the 'Creation' area\n        addlast(Creation)\n        {\n            group(MyNewActionGroup)\n            {\n                action(MyNewAction)\n                {\n                    Caption = 'My New Action';\n\n                    trigger OnAction();\n                    begin\n                        Message('My message');\n                    end;\n                }\n            }\n        }\n    }\n}\n\ntableextension 70000020 CustomerTableExtension extends Customer\n{\n    fields\n    {\n        // Adding a new table field in the 'Customer' table\n        field(50100; ShoeSize; Integer) { }\n    }\n}\n```\n## Page extension examples\nIn the following example, we use a table extension to extend the Customer table with a new field named ShoeSize of the datatype Integer. Then we create a page extension object that extends the Customer Card page object by adding a field control ShoeSize to the General group on the page. The field control is added as the last control in the group using the addlast method. The example also illustrates how to add a display-only control to the page.\nIn the actions area, you can see what the syntax looks like for actions that execute triggers and actions that run objects.\n```al\ntableextension 50115 RetailWinterSportsStore extends Customer\n{\n    fields\n    {\n        field(50116;ShoeSize;Integer)\n        {\n            Caption = 'ShoeSize';\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\npageextension 50110 CustomerCardExtension extends \"Customer Card\"\n{\n    layout\n    {\n        addlast(General)\n        {\n            // control with underlying datasource\n            field(\"Shoe Size\"; ShoeSize)\n            {\n                ApplicationArea = All;\n\n                trigger OnValidate();\n                begin\n                    if (ShoeSize < 10) then\n                        Error('Feet too small');\n                end;\n            }\n            // display-only control (without underlying datasource)\n            field(ShoesInStock; 10)\n            {\n                ApplicationArea = All;\n                Caption = 'Shoes in stock';\n\n            }\n        }\n\n        modify(\"Address 2\")\n        {\n            Caption = 'New Address 2';\n        }\n    }\n\n    actions\n    {\n        addlast(Creation)\n        {\n            group(MyActionGroup)\n            {\n                Action(MyAction1)\n                {\n                    ApplicationArea = All;\n                    Caption = 'Hello!';\n\n                    trigger OnAction();\n                    begin\n                        Message('My message');\n                    end;\n                }\n\n                Action(MyAction2)\n                {\n                    ApplicationArea = All;\n\n                    // Run page to test how actions work\n                    RunObject = page \"Absence Registration\";\n                }\n            }\n        }\n    }\n}\n```\nYou can reference Report and XMLPort objects and use these objects in the RunObject property, as well as, declare variables of the types Report and XMLPort and call AL methods on them. This page extension object extends the Customer List page object by adding two actions; the first action calls the Customer - List report, the second action calls the Export Contact XMLPort.\n```al\npageextension 50114 AddCustomerReport extends \"Customer List\"\n{\n    actions\n    {\n        AddLast(\"&Customer\")\n        {\n            action(\"Customer List Report\")\n            {\n                trigger OnAction();\n                var\n                    rep : Report \"Customer - List\";\n                begin\n                    rep.Run;\n                end;\n            }\n\n            action(\"Export Contact List\")\n            {\n                trigger OnAction();\n                var\n                    xml : XmlPort \"Export Contact\";\n                begin\n                    xml.Run;\n                end;\n            }\n        }\n    }\n}\n```\n## Related information\ndevenv-page-object\ndevenv-views\nPage, page fields, and page extension properties<properties/devenv-page-property-overview>\nExtending pages previously based on the Date Virtual Table<devenv-extend-pages-based-on-date-virtual-table>\nDeveloping extensions<devenv-dev-overview>\nAL development environment<devenv-reference-overview>"}