Редактиране

Споделяне чрез


Page customization object

The page customization object in Business Central allows you to add changes to the layout and actions on page that are accessible for a profile. See Using keywords to place actions and controls for how to place actions and controls on a page customization object.

The page customization object has more restrictions than the page extension object; when you define a new page customization object, you cannot add variables, procedures, or triggers.

Note

A single page customization can be used with multiple profiles within the same extension. Page customizations only apply to the RoleCenters they are specified for. In order to view or changes the RoleCenters in the client, go to My Settings, and then choose Role Center.

Note

Extension objects can have a name with a maximum length of 30 characters.

Note

Modifying actions in Cue groups on page extensions is not supported.

Note

The property allowDebugging, which is a setting under resourceExposurePolicy doesn't apply to page customizations. Page customizations defined in an extension with allowDebugging set to false can still be copied Use Designer. For more information, see Resource Exposure Policy Setting.

Snippet support

Typing the shortcut tpagecust creates the basic layout for a page customization object when using the AL Language extension for Microsoft Dynamics 365 Business Central in Visual Studio Code.

Tip

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.

Views

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

Page customization example

The following page customization example MyCustomization makes changes to Customer List. By using the moveafter method, Blanket Orders is moved after the Orders action item. And the modify method is used to hide the NewSalesBlanketOrder action item.

profile TheBoss
{
    Description = 'The Boss';
    RoleCenter = "Business Manager Role Center";
    Customizations = MyCustomization;
    Caption = 'Boss';
}

pagecustomization MyCustomization customizes "Customer List"
{
    actions
    {
        moveafter(Orders; "Blanket Orders")

        modify(NewSalesBlanketOrder)
        {
            Visible = false;
        }

    }
}

You can use the same page customization on another profile within the same extension package by referencing its name from the profile definition, for example:

profile TheSalesman
{
    ProfileDescription = 'The Boss';
    RoleCenter = "Sales Manager Role Center";
    Customizations = MyCustomization;
    Caption = 'Salesman';
}

Adding groups and page fields based on table fields

APPLIES TO: Business Central 2023 release wave 2 (version 23) and later

You can add groups and page fields using a table field as source expression in page customizations as illustrated in the following example:

pagecustomization MyPageCust customizes MyPage
{
    layout
    {
        addfirst(Content)
        {
            field(MyPageCustField; Rec.MyTableField) {...}
        }
    }
}

To specify if a table field can be used as a source expression for page fields that are created in page customizations, use the AllowInCustomizations. Default is that a table field can be used in such a way.

See Also

Developing Extensions
AL Development Environment
Page Object
Page Extension Object
Views
Page, Page Fields, and Page Extension Properties
AllowInCustomizations