Hi Prakhar,
I am not sure if I understand the issue thoroughly, let me put a possible solution in to some points;
1- Are you using ‘open page’ to show home page, then use a microflow instead.
2- The object you are working on would be parameter to this flow and instead of on leave action, you may check the changes here, in this microflow and handle ‘go to pages’ through decisions.So discard popup should be handled before opening next/home page.
Please let me know if I got the issue right,
Ferhat
Hi Prakhar Pincha,
When you trigger a custom “on leave” action that reopens or refreshes a page, Mendix destroys the in-memory (uncommitted) object context and loads a fresh one, causing unsaved data to disappear.
Recommended Approaches
1.Save data temporarily before leaving the page. Instead of directly reopening the page, store the unsaved data in a non-persistent helper entity. Pass this object when reopening the page, so that the user’s edits are preserved.
Example flow: On leave action → Check for unsaved changes →If yes → Copy data to helper object →Reopen page with helper object context Then when the user confirms “Save”, copy data from helper → main entity and commit.
---
2.Use a confirmation popup before navigation Instead of reopening the page automatically, show a popup with two options:
Only navigate after the user chooses.
This avoids reloading the page before the user decides.