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;

  • Suggested answer
    Bilal Haider Profile Picture
    487 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
    IB-29041624-0 Profile Picture
    1,191 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
    487 on at

    Updated:

    Check if property RefreshOnActivate is on for ListPage

  • Suggested answer
    YUN ZHU Profile Picture
    103,227 Super User 2026 Season 2 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

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 720 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 436 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 409 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans