Get started with page extensions
The page extension object extends a Dynamics 365 Business Central page object and adds or overrides the functionality.
The 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.
The Page Extension object is used to extend existing pages in the Business Central application. Key information about page extensions includes:
With a page extension, you can modify some page properties but not all of them. For example, you can't change the ID and the Name properties.
You can add new fields and modify some properties of existing fields, but you can't delete existing fields. If you want to remove a field from a page, you must set the Visible property to false.
Creating a page extension works the same way as creating a page, by using the tpageext snippet.
In the layout section, define which fields you want to add to the page or which existing fields you want to move or modify.
The layout section has nine keywords, which determine what should happen with your control. These keywords are:
addfirst(anchor) - Specify the anchor, which can be an area or group. The control that will be added will be positioned first within this container.
addlast(anchor) - Specify the anchor, which can be an area or group. The control that will be added will be positioned last within this container.
addafter(anchor) - Specify the anchor, which can be a group or another control. The control that will be added will be positioned directly after the anchor.
addbefore(anchor) - Specify the anchor, which can be a group or another control. The control that will be added will be positioned directly before the anchor.
modify(name) - Use to modify properties of an existing control on the page. Specify the control by using the name of the control.
movefirst(anchor; controls) - Specify the anchor, which can be an area or group. The specified control(s) will be moved to the first position within the container. This action is only possible on controls that are already defined on the page.
movelast(anchor; controls) - Specify the anchor, which can be an area or group. The specified control(s) will be moved to the last position within the container. This action is only possible on controls that are already defined on the page.
moveafter(anchor; controls) - Specify the anchor, which can be a group or control. The specified control(s) will be moved directly after the anchor. This action is only possible on controls that are already defined on the page.
movebefore(anchor; controls) - Specify the anchor, which can be a group or control. The specified control(s) will be moved directly before the anchor. This action is only possible on controls that are already defined on the page.
Every page extension has its own name. We recommend that you use a prefix or suffix in the name of your object so that it's unique. For each field or action in the page extension, you must also specify a prefix or suffix in the name of the field or action.
Views 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 Pages, Page Extensions, and Page Customization. For more information, see Views.
Business Central 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. For more information, see Add tooltips to table and page fields.
In the following example, the Customer Card page is extended. Two extra fields have also been added to the page. These fields are created through a table extension on the Customer table.
After the General FastTab is another FastTab called Social Media. Within that group, Facebook and Twitter fields have been added. In the final step, the existing Email field from the Customer Card will be moved after the Twitter field.
Adding, moving, and modifying actions works the same with fields.