function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WietzeWietze 

Is there a way to prevent concurrent editing of the same record?

Scenario:

1) User A edits object 123 & makes changes

2) Meanwhile, User B edits object 123 & makes different changes

3) User A saves object 123 --> success

4) User B saves object 123 --> error

5) User B gets error:

Your Changes Cannot Be Saved

The record you were editing was modified by <username> during your edit session

Please <link> re-display the record before editing again.

 

User B has wasted their time and now must re-enter their changes.

 

Is there a way we could alert User B that User A was already editing the record?

venkataramanavenkataramana

We have exactly the same requirement.  Appreciate if someone can share a solution to alert the users while opening the record if it is already being edited by other user(s).

admintrmpadmintrmp
Although possible, it's not effective and could cost you more time than it's worth as how would you know when the user is NOT editing the record any more? If the user closes the browser, would you want to wait for the session to timeout before you can edit that record again?

The only possible way, would be to update the record with a flag to say that the record is being edited, and then when the user leaves or saves the record, you update the record saying it is no longer being edited. BUT, if the user unexpectedly leaves, the system has to be sure that the user has left. So you would need to wait a good long while before allowing access to the record again.

Another solution would be to record everything that the user does. So when a user views the record, you submit a record into the database that notifies the system of the users location in Salesforce. If they are editing a record, the system understands this. You will still have the issue of the whereabouts of the user if they were to unexpectedly close the browser.
Vickie LitherlandVickie Litherland
The original post here was from December 2012. Has Salesforce done anything to change this behavior since then? I need to understand exactly what the current functionality does and does not do? Does the system at least give the user who's changes were not saved, get an error message of some sort? Is there a way to perhaps merge the information? 

Thanks in advance.