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
Rick_NookIndRick_NookInd 

Data Loss with No Error Message when Same User Changes Record Twice?

I'm doing some testing whether it is safe to put the more critical of our medium sized business data on SalesForce, and quite unexpectedly a test seems to have revealed a data integrity issue.

 

If you open up an edit screen on a record and then in some other way modify the same record with the same user perhaps even a second edit screen (or trigger/API/visualforce page), the original edit screen does NOT give you the traditional error message "The record you were editing was modified by _(you)_ during your edit session." when you hit save.

 

As with any data integrity issue, couldn't this be a disaster in the making?

 

For example, lets say one tracks their inventory with SalesForce, which is one of many things we are planning.  If I allocate inventory directly or indirectly in one way while I happen to have a part edit screen up perhaps to change the standard cost of the part but not change the inventory level, I just accidentally removed the previous decrement to the inventory level on the part record.

 

Am I the first to detect such?  Can I get some agreement that it is indeed a bug and not safe for mission critical data on SalesForce.com servers if there are standard UI edit screens for those custom objects?  I mean if all it takes is the same user to open the same record twice for data loss to occur, how could it be safe?

 

All I can think of is disable inline editing and to not use any of the standard SalesForce edit pages ever and replace them with VisualForce pages with Custom Controllers to detect and appropriate error out in those circumstances, but that seems like a LOT of extra effort, maintenance, loss of functionality, and perhaps exceeding some salesforce limit unnecessarily.

 

Thoughts?  Comments?  Suggestions?  Anyone know a Product Manager who might be interested in fixing this design problem in one of their teams?

 

Is anyone else concerned that there may be data loss?

werewolfwerewolf

I do not agree that this is a bug. 

 

The locking behavior in Salesforce.com is specifically intended to prevent different users from overwriting each others' changes -- it is not intended to protect users from their own boneheaded moves.  In this case, the very same user would have to take an action that has a side effect of updating inventory, and would then have to save something which manually updates the inventory.  Salesforce.com's locking mechanism would not prevent against that.  If it did, then it would also be extremely annoying -- any user who happened to open the same edit page twice and make mutually exclusive changes on the object would be blocked from doing so (the second time, anyway).

 

For example, if you are updating inventory in an automated fashion then don't make it easy for users to update inventory manually -- keep the inventory field read-only on standard part pages and add an Override link for users to override it if they need to do so intentionally. That would cover both the standard and inline editing cases.

 

If that's not feasible, add some before insert and before update triggers that detect if the inventory has been automatically changed and a manual change is incoming, and block it.  That's not that hard at all.

Rick_NookIndRick_NookInd

I thought about it over the weekend hoping I could convince myself to agree with you Werewolf.

 

But does it really matter if it is the same user or multiple users that are doing multiple different actions if they end up corrupting the data when they appropriate perform those actions?  I'm not talking about "boneheaded moves" here.

 

Note I know I can make workarounds.  My concerns is more general: that I may have to make hundreds of workarounds to protect data integrity or limit great functionality like inline editing. Perhaps my example is weak.  Lets try another.

 

Lets say there is a quote object that is child of opportunity.  The same user opens up both the quote object and the opportunity object to make trivial edits.  A update trigger on the quote object does an update to the opportunity object perhaps to change the opportunity status now that the quote is "Quoted".  Yet that change gets overwritten because they hit the save button on Quote before the save button on Opportunity? (and the same user made both changes)

 

Unfortunately, I could go on an on with examples, and this greatly concerns me as it almost seems like crack in the foundation upon which SalesForce and Force.com is built.

 

Why would appropriately informing the user when they are making mutually exclusive changes be extremely annoying? (beyond having to perhaps have to retype some information to save that information without corrupting the database which admittedly is annoying but necessary)