Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Page Predefined Views

(1) ShareShare
ReportReport
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)
            }
        }
    }
  • Suggested answer
    MH-06060002-0 Profile Picture
    MH-06060002-0 45 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 13,011 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,703 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans