Defining Custom Views in an AL Page Extension
You are creating a page extension for the Customer List page in a Dynamics 365 Business Central extension. The extension must provide the following implementation: • The page view must show only customers with Balance Due (LCY) > 1000 and with CountryRegion Code = US • The view must display only some custom fields from the Customer table You need to define the page view and the required filter. Which two actions should you perform? Each correct answer presents part of the solution. (Choose two.) NOTE: Each correct selection is worth one point.
Community Insight
The question tests where page views live in a page extension and how the SharedLayout property controls whether a view can present its own set of fields — the trap is assuming SharedLayout = true or placing the view inside layout or actions.
In an AL page extension for the Customer List page, a filtered, field-reduced customer view must be declared in the views section, using a where clause for Balance Due (LCY) > 1000 and CountryRegion Code = US. Because the view shows only some custom fields, it must own its field layout, which requires SharedLayout = false.
The most common wrong pick is option E (SharedLayout = true), because learners associate 'shared' with reusing the page. SharedLayout = true forces the view to reuse the extension's existing layout, so it cannot display only a subset of custom fields; placing the view in the layout or actions section (A or C) is also syntactically wrong.
Community Discussion (1 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
In AL, a page extension exposes a dedicated views section where you declare named views such as view(USHighBalance) with a where filter, for example where("Balance (LCY)" > 1000, "Country/Region Code" = 'US'). Setting SharedLayout = false detaches the view from the page's shared field layout so you can add, modify, or hide only the custom Customer table fields the requirement calls for, which is exactly what option D plus option B deliver together.Why the Other Options Are Wrong
Views are neither placed in the layout section nor in the actions section — layout holds the field/pagepart container definitions and actions holds action items, so options A and C are invalid AL structure for a view. Option E, SharedLayout = true, is the default behavior that makes the view reuse the existing layout; that directly conflicts with the requirement to show only some custom fields, since you cannot remove fields from a shared layout on a per-view basis.Community Comment Notes
A learner voted B and D and justified it by noting that "The view must display only some custom fields from the Customer table" means the view needs its own layout, so "SharedLayout = True will not satisfy the requirement." That reasoning supports dropping option E and confirms the SharedLayout = false choice; no comment defended placing views in the layout or actions sections.Official Reference
Exam Strategy
When a requirement says a view must show a different set of fields, always pair a views-section declaration with SharedLayout = false, plus a where clause for the filters. If the requirement were only filtering while keeping the same fields, the default shared layout would be enough — read carefully which one is asked.
Frequently Asked Questions
Why can't I use SharedLayout = true for this Customer List view?
SharedLayout = true makes the view reuse the page's existing field layout, so you cannot remove fields. Since the requirement is to show only some custom fields, the view needs its own layout via SharedLayout = false.
Where is the where filter placed for a view in a page extension?
Inside the view block in the views section, for example where("Balance (LCY)" > 1000, "Country/Region Code" = 'US'), alongside the optional layout block when SharedLayout is false.