The standard behavior (tested on Opportunities) is that Salesforce seems to handle dirty updates / save conflicts as expected:
- User A opens Opportunity X
- User B opens Opportunity X
- User A modifies and saves Opportunity X
- User B modifies and tries to save Opportunity X
- User B sees a conflict error and CANNOT override unseen changes from User A
When I try this on a custom object with a controller extension that has a custom
doSave() method that calls
standardController.save() the behavior is different and has dirty updates.
- User A opens Custom Object X
- User B opens Custom Object X
- User A (implicitly by a triggered Batch job) modifies and saves Custom Object X
- User B modifies and SUCCESSFULLY saves Custom Object X
- User B sees a has reverted all changes that were saved by User A
The problem is 5. User B has accidentally overriden all the changes made by User A just because he still has them in memory.
Do I need to handle / prevent this on my own in my controller extension?
Or should I call
update instead of
standardController.save() in my custom save method?