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

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
    412 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,105 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
    412 on at

    Updated:

    Check if property RefreshOnActivate is on for ListPage

  • Suggested answer
    YUN ZHU Profile Picture
    95,311 Super User 2025 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

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 3,177

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,467 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,435 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans