Build reusable views for role-based work
Views turn a recurring list filter and sort operation into a named choice. You can define a view on a list page, page extension, or page customization, depending on who should receive it.
Choose where the view belongs
Place the view according to its audience:
- Define it on a page when it's part of the page's core experience.
- Define it on a page extension when every user of that extension should receive it.
- Define it on a page customization when only users of an associated profile should receive it.
A page customization is a useful fit for role-specific work because the profile controls where the view appears. The following customization adds a view to the standard Customer List page:
pagecustomization "Cust Follow-up Customization" customizes "Customer List"
{
views
{
addfirst
{
view(ActiveCustomers)
{
Caption = 'Active customers';
Filters = where(Blocked = const(" "));
OrderBy = ascending(Name);
}
}
}
}
The Filters property applies filters to source-table fields, including fields that aren't shown on the page. The OrderBy property sorts by one or more table fields in one direction. In this example, the view limits the list to unblocked customers and sorts them by name.
Control shared and independent layouts
By default, a view shares the field layout of the page's All view. User personalization can therefore apply to both the All view and the shared-layout view. This behavior is appropriate when the view changes only the record set or sort order.
Set SharedLayout = false when the view needs its own extension-defined column arrangement. You can then add a layout section inside the view.
view(HighPriorityCustomers)
{
Caption = 'High-priority customers';
Filters = where(Priority = const(High));
SharedLayout = false;
layout
{
movefirst(Control1; Name)
}
}
An independent layout doesn't inherit user personalization from the All view. Use it when a specific column order is part of the role's task, not simply to make every view look different.
Design discoverable views
Use a short caption that describes the records, such as Active customers, rather than the implementation, such as Blocked equals blank. Keep filters predictable and avoid hiding records that users reasonably expect to find. Views organize data; they don't enforce authorization or replace permission filters.
The views section must follow the layout and actions sections on a page, page extension, or page customization. Views can't use variables or methods. These constraints keep a view declarative and allow the client to expose it consistently in the filter pane.
For more information, see Views.