Business Central 2025 wave 1 (BC26): Specify page layout mode (analysis/list/talltiles/tiles) on the GetUrl Method

Dynamics 365 Business Central

Hi, Readers.
The public preview for Dynamics 365 Business Central 2025 release wave 1 (BC26) is available. Learn more: Link.

I will continue to test and share some new features that I hope will be helpful.

This new feature is not yet documented in the Business Central 2025 release wave 1 (BC26) release plan but is mentioned in AL Language extension changelog Version 15.0

It is now possible to specify layout on the GetUrl command.

https://marketplace.visualstudio.com/items/ms-dynamics-smb.al/changelog

With Business Central 2024 wave 2 (BC25.1), Microsoft added new URL parameter (layout) to change page layout. More details: Business Central 2024 wave 2 (BC25.1): New URL parameter to change page layout (layout=analysis/list/talltiles/tiles)

  • Analysis mode: analysis
  • Classic list mode: list
  • Large tiles with images: talltiles
  • Small tiles or ‘bricks’: tiles

And, if we want to generate a BC URL, we generally use the System.GetUrl() Method. We have used it in the following discussions.

System.GetUrl() Method: Generates a URL for the specified client target that is based on the configuration of the server instance. If the code runs in a multitenant deployment architecture, the generated URL will automatically apply to the tenant ID of the current user.

Since MS Learn (Docs) has not been updated yet, let’s take a look at the procedure in VS Code. Microsoft added [Layout: Text] at the end.

procedure GetUrl(ClientType: ClientType, [Company: Text], [ObjectType: ObjectType], [ObjectId: Integer], [Record: Table], [UseFilters: Boolean], [Layout: Text]): Text

A Simple Example:

URL parameter (page layout mode) is automatically added.

It can be opened directly through System.Hyperlink(Text) Method.

Let’s look at another simple example. Allows the user to choose the page layout mode to open.

Test video:

Test code:

pageextension 50102 CustomerListExt extends "Customer List"
{
    actions
    {
        addafter("Co&mments")
        {
            action(OpenCustomerList)
            {
                Caption = 'Open Customer List';
                ApplicationArea = All;
                PromotedCategory = Process;
                Promoted = true;
                Image = Open;
                trigger OnAction()
                var
                    Layouts: Label 'analysis,list,talltiles,tiles';
                    Selection: Integer;
                begin
                    Selection := StrMenu(Layouts);
                    case
                        Selection of
                        1:
                            Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Page, Page::"Customer List", Rec, false, 'analysis'));
                        2:
                            Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Page, Page::"Customer List", Rec, false, 'list'));
                        3:
                            Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Page, Page::"Customer List", Rec, false, 'talltiles'));
                        4:
                            Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Page, Page::"Customer List", Rec, false, 'tiles'));
                    end;
                end;
            }
        }
    }
}

Very simple. Give it a try!!!😁

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL