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

Revert a boolean value to its original value when user chooses 'No' on confirm dialog

(0) ShareShare
ReportReport
Posted on by 10

I need to revert a value on a page to what it was at the time the page was opened if the user clicks 'No' on the confirmation dialog.

This is what I have now.

OnOpenPage()
ActiveStatus := Active;
CloseStatus := Close;

...

OnQueryClosePage(CloseAction : Action None) : Boolean
ReviewPeriod.GET(Code);
PhaseNo := Name;

IF Close <> CloseStatus THEN BEGIN
ConfirmChanges := ConfirmMsg;
Answer := DIALOG.CONFIRM(ConfirmChanges, TRUE, PhaseNo);

IF Answer THEN
EXIT;
IF NOT Answer THEN BEGIN
Rec.Close := CloseStatus;
EXIT;
END;
END;

I have the same question (0)
  • Suggested answer
    Bilal Haider Profile Picture
    442 on at

    Hi,

    I think you just need to call Rec.MODIFY before EXIT in last third line. Rest of code look fine.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,161 Moderator on at

    I think you also should look into doing this in the OnValidate trigger on the table instead of in the page.

    What if your data it modified outside of this one page?

  • Jesse Otu Profile Picture
    10 on at

    Thanks raibilalhaider . It works but the changes are made on a card page and do not reflect on the corresponding list page unless I refresh it. Any suggestions?

  • Jesse Otu Profile Picture
    10 on at

    NorthW That's not really necessary because that field is exclusive to that page. So, unless changes are made in the development environment, it should be fine.

  • Suggested answer
    Bilal Haider Profile Picture
    442 on at

    Updated:

    Check if property RefreshOnActivate is on for ListPage

  • Suggested answer
    YUN ZHU Profile Picture
    98,421 Super User 2026 Season 1 on at

    Hi, What happens if you close the current page and reopen it in your code? I tested in Card Page, this works.

    https://yzhums.com/16756/

    pastedimage1678929823028v1.png

    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

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,857 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,047 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans