Dynamics 365 Business Central Mini tips: How to create new list view for all users

Dynamics 365 Business Central

Hello everyone.
If you have used NAV, you must know “Save and Personalize List Views” feature.
When you have set a filter on a list and you want to keep the filter for later, you can save it as a view.

Let’s recall this feature in NAV.
First open any list page (Customer Ledger Entries), set one or more new filters you want to save.

Click “Save View As…”

Enter a “Name” and “Activity Group”, then click “OK”

After you restart your windows client. You can find the view you created.

It is a very useful feature that you can save your frequently used filters, and can switch at any time.
Fortunately, this feature was added to Business Central in the previous version.

Open any list page (Customer Ledger Entries) in Business Central, set one or more new filters you want to save.
Then Click “Save as…”.

Enter a name, the view will be saved.
If you set a filter for a list view that that is already saved as a view, the existing view will be updated when you save.

But the view you set is personal, If you are a developer, or an administrator, how to create new list view for all users?

We can use PageExtension to add new view in Visual Studio Code.
Note: The format of the date depends on the Region in “My Settings” of Business Central.

pageextension 50100 CustomerLedgerEntriesExt extends "Customer Ledger Entries"
{
    views
    {
        addfirst
        {
            view(AddFromVSC)
            {
                Caption = 'Add From Visual Studio Code';
                Filters = where("Posting Date" = filter('200201..200331'),
                        "Customer No." = const('20000'),
                        Open = const(false));
            }
        }
    }
}

After you Publish, you can confirm that the view is automatically added for all users.

MS Docs:
Save and Personalise List Views

Hope this will help.
Thanks.

コメント

Copied title and URL