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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Prevent Card Page Navigation if field is blank

(7) ShareShare
ReportReport
Posted on by 765
I have been reading this article (https://yzhums.com/45007/) on how to prevent a Card page from being closed if a field is blank.  Using the OnQueryClosePage and Rec.TestField() code works great.  However, this does not prevent a user from navigating to the next or previous record.
 
I've also look at code that can be placed in the OnOpenPage trigger using the Rec.SetFilter, which is fine if I want to always prevent record navigation, but how about conditionally based on a field being blank.
 
I have tried using the Rec.SetFilter logic in a fields OnAfterValidate trigger, but that does not seem to work.
 
Any thoughts on how to accomplish this?
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at
    This can only be achieved by preventing users from using the 'Go to Next/Previous document' action, as far as I know there is no other way.
     
    Thanks
    ZHU
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,128 Super User 2026 Season 1 on at
    Yes, the only way to do this is by disabling the Back and Next buttons in Business Central.
  • Suggested answer
    Aman Kakkar Profile Picture
    2,977 Super User 2026 Season 1 on at
    Hi,
     
    Totally agreed with the experts on this — it’s not possible to implement this conditionally in a page extension or via a clean trigger combination.
     
    • The OnNextRecord trigger is not available in page extensions. It only works in custom pages, and even then, if you throw an error from there, the page will simply close after showing the error, which defeats your main goal of keeping the page open.
       
    • The OnQueryClosePage trigger only fires when closing the page (not during navigation), so it can’t help with arrow-based record movement.
       
    • The SetFilter trick can lock the page on one record, but it can’t be conditionally applied or dynamically toggled — once applied, it persists for the entire session.
     
    Hope this helps.
    Aman K
  • Suggested answer
    Pallavi Phade Profile Picture
    5,420 Super User 2026 Season 1 on at
     
    I agree with ZHU , this is only way . We also had implemented for one of usecase . 
     
     
    Regards
    Pallavi Phade 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans