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...
Answered

How to show a warning message at the time of closing a page in Microsoft Dynamics 365 Business Central

(0) ShareShare
ReportReport
Posted on by 245

Hi experts, how are you all doing? Hope you're all doing great. I'm looking for a way to show a warning message at the time of closing a page.

I'm customizing customer card page. I want to show a warning message 'Do you want to close page without Vat. Registration No.?' at the time of closing customer card page. If a user selects 'Yes' then current card page should be closed but if a user selects 'No' then current card page should not be closed.

qwas.jpg

Answers will be highly appreciated.

  • Suggested answer
    JAngle Profile Picture
    159 on at

    There is a page trigger you can adjust with a page extension: docs.microsoft.com/.../devenv-onclosepage-page-trigger

    Add your logic and a confirmation dialog: docs.microsoft.com/.../dialog-confirm-method

  • M Hussnain Javed Profile Picture
    245 on at

    Hi Josh Anglesea, thanks for replying. The problem is solved by using the following code:

    trigger OnQueryClosePage(CloseAction: Action): Boolean
        var
            Bool: Boolean;
        begin
            if (((rec."Profile Category" = rec."Profile Category"::Insurer) OR (rec."Profile Category" = rec."Profile Category"::Corporate)) AND (rec."VAT Registration No." = '')) then begin

                Bool := Dialog.Confirm('Do you want to close page without VAT Registration No.?');
                if Bool = false then
                    exit(Bool);
            end;
        end;

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 755 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 413 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 387 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans