Sometimes different users change the same record at the same time. The last one who saves the records, overwrites the earlier changes by the other user. And it is likely both users won't even notice!
If this scenario is a daily practice, you probably need an optimistic locking mechanism in your application. Optimistic locking is when you check if the record was updated by someone else before you commit the transaction. (Pessimistic locking is when you take an exclusive lock so that no one else can start modifying the record)
In this topic a solution for optimistic locking is provided.
First of all, by dynamic model code, every table gets an extra column, update_counter. This column is update after the commit of an update, or, when in the meantime the counter is incremented by another process, it will throw a message.
This dynamic model code adds column to the tables. With the tag NO_UPDATE_COUNTER you can exclude a table from this mechanism.
This control procedure increases column update_counter, or gives an error when the counter was increased by another process or user.
This template increases column update_counter, or gives an error when the counter was increased by another process or user.
In the attachment you will find the code of this solution.