Alternative autocommit after user cancel

0
Hi all, we are getting autocommit and I know why, just looking for suggestion on how to handle the required functionality.    We have a Risk Assessment into the app, and it links 1-* with several entities, such as “people involved” and “risk log”.   We have a requirement to save a previous version of the risk assessment whenever it is reviewed and changed, this includes the linked entities.    At the moment when the user clicks the review button it will create the review object, but then also create and commit the previous version object, it will then go through retrieving all the linked entities, iterating over them and linking them to the previous version object, it then commits this. The purpose is we have the risk assessment as it was before the commit saved. As it’s associated it autocommits the risk assessment review object, then if the user cancels it will remove it from the database later.  (Note – as typing I have realised that removing the association and using attributes to link them together will solve this problem. So will be trying this, but will continue the question as it may help people in the future and also someone may know a better best practise for this scenario)   So we get the autocommit error, due to the user cancelling the process. My first thought was that we should not be committing the ‘previous version’ entity this early and if it was just one entity we could probably get away with moving it to the save microflow and creating it by retrieving the unchanged version of the risk assessment from the database and use that to fill the previous version before commiting the new changes. However, as the associated objects (the people involved and risk log) are changed during review process so we need to make sure they are committed before the user makes the changes.
asked
0 answers