Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Page Predefined Views

Posted on by 2
Hello Community,
 
I have page created in code with 2 predefined views. that provide filtering as well as moving around fields see below.
 
What is the correct way to open the page from code with one of those predefined views as the active view?
 
Thanks so much
 
MJH
 
 views
    {
        view(NewDonations)
        {
            Filters = where(Gross = filter(>= 0), MatchedToDoc = filter(= ''));
            SharedLayout = false;
            layout
            {
                moveafter(name; email)
                moveafter(email; MatchedToCust)
                moveafter(MatchedToCust; MatchedToItem)
                moveafter(MatchedToItem; MatchedToClass)
                moveafter(MatchedToClass; Subject)
                moveafter(Subject; Note)
                moveafter(MatchedToCust; lookupname)
            }
        }
        view(NewExpenses)
        {
            Filters = where(Gross = filter(< 0), MatchedToDoc = filter(= ''), type = filter(<> 'T403'));
 
            SharedLayout = false;
            layout
            {
                moveafter(name; email)
                moveafter(email; MatchedToVend)
                moveafter(MatchedToVend; MatchedToPatron)
                moveafter(MatchedToPatron; MatchedToGLAccount)
                moveafter(MatchedToGLAccount; MatchedToClass)
                moveafter(MatchedToClass; Subject)
                moveafter(Subject; Note)
                moveafter(MatchedToVend; lookupname)
            }
        }
    }
Categories:
  • Suggested answer
    MH-06060002-0 Profile Picture
    MH-06060002-0 10 on at
    Page Predefined Views
    Thank you for the response. I have been unable to locate a way to open a page referencing the predefined view.
     
    A bit of a hack to get it to work is the following
     
    1) When you manually select the predefined view the URL appends a query string which contains the following:   &view=162d53bc-9ab9-477e-a2b4-680605c_NewDonations
    2) In my scenario i utilized the below code
    3) The only drawback is it opens in a new tab
    4) You can utilize the following idea to make it open in the current window Thank You YZHUMS!   https://yzhums.com/29051/
     
    I hope am overlooking something more simple
     
     
    st := system.GetUrl(ClientType::Current, '', ObjectType::Page, 50103);
    st := st + '&view=162d53bc-9ab9-477e-a2b4-68063e05c_NewDonations';
    System.Hyperlink(st);
  • gdrenteria Profile Picture
    gdrenteria 9,472 Most Valuable Professional on at
    Page Predefined Views
    Hi
    As the documentation indicates,
    The defined view or views are available to the user through Filter Pane on a page and appear in the sequence that they're defined in code.
    So if you want to have a default view, in the open event of the page you could apply the desired filter.
    Best Regards
    Gerardo

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans