+ Start a Discussion
Jay KanchanaJay Kanchana 

Record Lock while editing custom record

Hello!

We are debating 2 solutions to custom lock records while users edit the record:

background: If user A is editing a record and if user B edits the recod at the same time, the changes get overwritten depending on the save sequence.

Solutions

1. use the last updated timestamp. cache the last updated timestamp when user clicks edits. when user clicks save, compare the current last updated timestamp with the cached timestamp. If they are different then display a warning message or disable the save button.

2. When a user clciks edit, set a recordLock custom field.  Display the edit button only if the recordLock field isnt set. when the user clicks cancel or save, reset the recordLock field so that its blank. Issue, if the user closes the browser without clicking cancel/save or if walks away leaving the window open in edit mode,  how do we reset the recodLock field?

I beleive option is most straightforward to implement and doesnt have any side effects. But might not be the most user friendly option because user will be notified of the record update only when they are trying to save.


we have custom object and visual force page.

Any thoughts? what methods have you implemented?

​-Jay