Skip to main content
Business Central forum
Suggested answer

Page Predefined Views

editSubscribe (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)
            }
        }
    }
Categories:
Attachments
  • Suggested answer
    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 3,007 Super User 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

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Demystifying Copilot with Sundar Raghavan

Sundar explains how Copilot for Service is meant to function separately...

Business Process Guidance Badges and New…

The Microsoft Success by Design is the framework for implementing Dynamics 365…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,281 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,025 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans