+ Start a Discussion
zirosziros 

The record you were editing was modified by XXXXXX

Hello all I'll explain the case that I have.
 
let's take for example the contacts...
 
Someone is updating a contact on salesforce..(change a certain field and saves)
There is a trigger on contact object which calls
an asp.net WebService (with @future) when a certian field is changed.
 
The asp.net web service do some work and at the end, it logins to salesforce and update another field on the same record.
 
until now all seems ok and working...
 
when the salesforce user continues to change the same record it get the error message above
The record you were editing was modified by XXXXXX
 
How to overcome this behaviour ??
 
another question regarding this case ,
is there any option that after the webservice finishes to do its work, to refresh the
salesforce contact page ?
 
TIA
 
Best Answer chosen by Admin (Salesforce Developers) 
Always ThinkinAlways Thinkin

Hi Appiphony,

Salesforce support pointed me to an Apex trigger that provides a workaround for the problem when caused by CTI (Mitel is ours). It definitely solves the problem but I've had to pay close attention to the code and unit tests when adding other Apex because it creates a number of different objects and tasks for them in its own unit tests.

 

Salesforce Support's explanation:

"The problem that is presented by some CTI adapters is that they create a closed task after a call has been ended but at the same time that a user is editing the parent record in the UI.  In essence, the system sees the user touching the System Modstamp twice at the same time, which is not possible, and then erroneously displays the Last Modified By user as a colliding user.  This same explanation applies to collision errors encountered when closed tasks or events are synced from Outlook/Lotus Notes while a user is editing the parent records in the UI.

 

[Note that this only applies to the following objects: Lead, Account, Contact, Opportunity, Campaign, and Contract.  To extend this workaround to custom objects, the customer has to update the Apex trigger themselves]" 

 

 

You can download the Apex as an Appexchange package here:

https://sites.secure.force.com/appexchange/apex/listingDetail?listingId=a0N300000016cUoEAI 

 

All Answers

Always ThinkinAlways Thinkin

Hi Ziros, 

Did you ever reach a resolution on this?

 I've been going around and around with Salesforce Support for three weeks on a similar issue (although no async APEX is involved, it just happens randomly). 

 Luke C 

AppiphonyAppiphony

Has any one ever figured this out? We have a similar issue with a client. They are using a softphone by Interactive Intelligence thatleverages the Salesforce CTI capabilities. They have a custom object that servesas a customer record.

 

1. Customer records are created in Salesforce by the Adminuser and then reassigned to a sales user.

2. A call comes in and the softphone pops the customerrecord and the sales person answers the phone.

3. They will then hit edit on the record and start updatinginformation on it.

4.The sales person hangs up the call and the softphone automatically writesa task record and attaches it to the customer record.

5. The user finishes updating the record and then goes tohit the save button and gets the following error:

 

"Your Changes Cannot Be Saved. The record you were editing was modified by Admin User during your edit session. Please re-display the record before editing again."

 

This only happens periodically and not every time so it hasmade it difficult to determine exactly what is causing it. The other thing wenoticed is that sometimes the record is not originally owned by the Admin userbut by another user and yet we still get the same error. It appears that the "created by" user is always the one that islisted in the error as having modified the record.

 

Do workflows or Apex or anything else run as the created byuser? Any thoughts on what might be causing this would be greatly appreciated.

Message Edited by Appiphony on 02-26-2010 05:50 AM
Always ThinkinAlways Thinkin

Hi Appiphony,

Salesforce support pointed me to an Apex trigger that provides a workaround for the problem when caused by CTI (Mitel is ours). It definitely solves the problem but I've had to pay close attention to the code and unit tests when adding other Apex because it creates a number of different objects and tasks for them in its own unit tests.

 

Salesforce Support's explanation:

"The problem that is presented by some CTI adapters is that they create a closed task after a call has been ended but at the same time that a user is editing the parent record in the UI.  In essence, the system sees the user touching the System Modstamp twice at the same time, which is not possible, and then erroneously displays the Last Modified By user as a colliding user.  This same explanation applies to collision errors encountered when closed tasks or events are synced from Outlook/Lotus Notes while a user is editing the parent records in the UI.

 

[Note that this only applies to the following objects: Lead, Account, Contact, Opportunity, Campaign, and Contract.  To extend this workaround to custom objects, the customer has to update the Apex trigger themselves]" 

 

 

You can download the Apex as an Appexchange package here:

https://sites.secure.force.com/appexchange/apex/listingDetail?listingId=a0N300000016cUoEAI 

 

This was selected as the best answer
AppiphonyAppiphony
Thanks a lot Luke! This appears to be exactly what we were looking for. I really appreciate you posting this.