web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Change view on page load

(5) ShareShare
ReportReport
Posted on by 95
Hello everyone,
 
I would like to change the default view (All) in the OnOpenPage triger of the project page to another one that has been created by us. I know that I can set the same filters with SetRange and SetFilter but the name of the filter is still All and I want it to be Opened (Rospa). That is, I want to simulate the user clicking on the custom view, not change the default view. The environment is OnPremise and version 16:
 
 
Is it possible?.
 
Regards
I have the same question (0)
  • Gerardo RenterĂ­a GarcĂ­a Profile Picture
    25,373 Most Valuable Professional on at
  • MiguelRospa Profile Picture
    95 on at
    Thanks for your reply. I've already seen that page but it doesn't solve my problem, so I'm writing on the forum. On that page a new window or a pop-up window opens on the same page. I want to change the selected view in the OnOpenPage event. I've seen in this thread (https://community.dynamics.com/forums/thread/details/?threadid=d3387e4d-eecf-ee11-9079-0022482447f6) that it seems you might know how to do it: "So if you want to have a default view, in the open event of the page you could apply the desired filter."
     
    Could you help me?
     
    Regards.
  • Verified answer
    DAnny3211 Profile Picture
    11,397 on at

    Hi Miquel 👋

    Thanks for your question!

    In Business Central OnPremise (version 16), it's not currently possible to programmatically simulate a user selecting a saved view (like "Opened (Rospa)") via AL code in the OnOpenPage trigger. The SetRange and SetFilter methods can replicate the filter logic, but they won’t change the view name shown in the UI—this remains "All" unless the user manually selects a different view.

    âś… What you can do:

    • Use SetView to apply filters and sorting that match your custom view.
    • Optionally, guide users to select the saved view manually if the view name is important for clarity.

    ⚠️ Limitations:

    • There’s no public API or AL method to programmatically activate a saved view by name.
    • This behavior is by design to preserve user control over view selection.

    💡 Alternative approach:
    If this is a frequent need, consider creating a custom action or page extension that applies the desired filters and labels the view accordingly.

    Hope this helps!
    âś… Please mark this reply as helpful if it answered your question.
    Best regards! 👋

     

    this post was generated with Copilot

  • Bret Fraser Profile Picture
    Community Manager on at
    Thanks for posting @DAnny3211, we appreciate your desire to help the Community!
     
    I think your reply might be an AI-assisted post, but I do not see any tools or sources cited. Can you update the post to include your sources, or confirm this was not produced using AI?
     
    Please refer to the Use AI responsibly section of Writing effective responses in the community
     
    Thank you for updating your post to show that it was generated with Copilot.
  • Suggested answer
    YUN ZHU Profile Picture
    95,748 Super User 2025 Season 2 on at
    As far as I know, the method mentioned in my blog post is the only one currently.
    You can also try the following method without opening a new page, but it's more complicated.
    Dynamics 365 Business Central: Using Hyperlink() Method to open a URL in a current session without opening a new tab in the browser
     
    However, if you are not switching views, but adding default filters, this can be done in the OnOpenPage Trigger.
    More details: Dynamics 365 Business Central: How to make some filters mandatory on the list page (users can not change or remove)
     
    Hope this helps.
    Thanks.
    ZHU

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans