when i am closing the form record will be saved.
How prevent saving a record while closing the form ?
thanks,
Khadar Shaikh
*This post is locked for comments
Hi,
Could you provide some more details about your requirement as many other actions/events on the form grid saves the record before closing the form.
Thanks,
Chaitanya Golla
Closing the form will save the record, which is the intended business functionality.
In case you want to close it without saving, there already is a feature for that, which is pressing the <ESCAPE> key, and confirming in the dialog you want to close without saving.
"If it ain't broke, don't fix it."
I presume this is how you would like to prevent unintended user actions. The correct solution is to set up security for them appropriately, so they would not be able to modify records which they are not supposed to!
If you still intend to break the default business logic, you could try to override the close() method on the form, do not call super(), but call element.closeCancel() instead, which is the equivalent of pressing escape. See how that works since I did not test it, but the solution should be somewhere along those lines.
If you do that, please realize that regular users who fill out the data and close the form without specifically pressing save or navigating away from the record would expect that the record changes are saved which you have now broken, would be upset.
Hi Vilmos Kintera,
I was try to override the close method by calling element.closecancel() without super.
but it is still saving the record.
Hi Chaitanya,
When we are crated a record on form and its not saved, i am closing that form by using 'X' button the record is saving. it is standard behaviour of a form. but in my case i don't want to save the record when i am closing the form.
Then it is technically not feasible. You need to solve this by the correct approach, and set up Security right.
Or if you do not want record manipulation at all, why not just set up AllowInsert and AllowEdit = No on the form datasource?
Hi Khadar,
You can configure AX to open a dialog for confirmation before commiting updates.
It might help with your requirement or at least might provide you a different starting point.
The setting is located in Options form and this form can be reached by following this path: File/Tools/Options
Please check Confirmation tab for "Confirm update" settings
In form data source method override write method and write this code
public void write()
{
if(element.closedOk())
super();
}
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Tocauer 4
Community Member 2
Nayyar Siddiqi 2