I am struggling with the error message "[BO] has been changed by another user. Please get the latest version of the data and try the operation again." when saving the form of that BO.
The situation is as follows:
There are BO rules for both the LineItems and the Transaction. In some cases, the Transaction BO rules are updated following changes in the LineItems, for example if there are LineItems added, removed or changed.
I understand that, strictly speaking, the Transaction is indeed changed, although I wouldn't regard this as being 'by another user' because it is by the same user that is trying to save the form. I also understand that the error can be avoided by first (manually) refreshing the form and then saving it. However, I don't want users to have to refresh before save, there should simply be one save button that does the job.
So how do I ensure that this can form can be saved, when there are changes as a result of the BO rules?
I read somewhere on this forum about the possibility to create a temporary BO, copy all data from the 'real' BO to the temp BO, then edit the temp BO, then copy everything back to the original BO upon save. That may be a solution, but it would be a lot of work because I would not only have to copy all direct attributes but also all of the references (in this case the LineItems) from the one to other and back again, so it is hardly an viable option. I am hoping there is a simpler solution. Presumably this situation where a BO is changed by its own business rules is rather common, so I can't quite understand why it must result in this error.