Page views and the SharedLayout property

MB-820 · Develop by using AL objects · Updated

Views are saved filters and layouts that appear as tabs at the top of a list page. Users love them, and you can ship them in AL.

Where views go

Views live in their own views section, not in layout or actions.

pageextension 50100 "Customer List Ext" extends "Customer List"
{
    views
    {
        addlast
        {
            view(USHighBalance)
            {
                Caption = 'US customers over 1000';
                Filters = where("Country/Region Code" = const('US'),
                                "Balance Due (LCY)" = filter(> 1000));
                SharedLayout = false;

                layout
                {
                    modify("Phone No.") { Visible = false; }
                }
            }
        }
    }
}

SharedLayout

ValueWhat it means
true (default)The view uses the page’s main layout. Only the filters and sorting change.
falseThe view has its own layout. You can hide, move or show different fields.

If a requirement says the view must show different columns, you need SharedLayout = false.

Exam traps

Views are never defined in the layout or actions section.

“Show only some fields” means a custom layout, so set SharedLayout = false.

Learn more: Defining page views.

Practice questions

Pick an answer to check it. Questions are original and written for practice.

1. In a page extension for a list page, where do you define a new view?

Show answer

Answer: C.Views have their own views section. In a page extension you use addfirst or addlast inside it.

2. Your view must show a different set of columns from the main list. What should you set?

Show answer

Answer: B.With SharedLayout = false the view gets its own layout, so you can hide or move columns without affecting the main page.

3. What is the default value of SharedLayout?

Show answer

Answer: A.The default is true. Layout changes the user makes apply to all views that share the layout.

Keep going