Get started with page extensions

Completed

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 - 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.

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.

Sample of a AL Page Extension for Business Central.

Adding, moving, and modifying actions works the same with fields.