In case of optimistic locking how can both the users save there changes to the case at the same time?

if you are updating a parent case/child case in case of optimistic locking but the second operator cant update the case as the first operator updated the case so he needs to refresh the case but if we want that both the users should be able to update there changes at the same time and there changes should reflect in the case,how can that be done?

It is not possible. The first user to click submit will successfully commit their changes. The second user will receive a locking conflict error and will be forced to refresh the case to re-enter their changes. Allowing both to save simultaneously without a refresh would result in a ‘last-in wins’ scenario, corrupting the first user’s data.

Hi @VVNagaSaiN so in this case cant we have a utility to release lock?i mean is that possible?

You risk confusing the users and as well as data integrity by releasing locks under the covers.

Changes must be made in a serial fashion. If two values were truly submitted simultaneously, how would you decide which one wins? There will always be a first submission and a subsequent submission (winner and loser, if you please). Optimistic locking provides a predictable way to allow multiple users to make changes while accepting the risk that their changes might be discarded by being the subsequent submission. If the user is not willing to accept this risk, standard locking should be considered.

Well quoted example @MMichalski