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
Yamini BathulaYamini Bathula 

Visualforce Page error in Salesforce Lightning

Hi,

We have a visualforce page in our salesforce org whose contoller class makes an API call and then display the result back on the page. This was placed on a record Detail page section in classic experince. It was working as expected. And we recently switched on Lightning Experience. The problem now is the visualforce page is working fine when the user clicks on command button in the page. It is getting the expected results. But it is gving an error when the user tries to update fields on the other sections after doing the API call(clicking the command button in the visualforce page).
This is the error:

This record was modified by USER during your edit session. Make a note of the data you entered, then reload the record and enter your updates again.

I am not sure what is causing this error.

Has anyone faced this issue?
It would be great if anyone can help.
Thanks,
Yamini.

 
NagendraNagendra (Salesforce Developers) 
Hi Yamini,

This message is displayed because of a security feature called Collision Detection. 

Collision Detection is used to prevent a user from saving their record changes if the record they are editing has been modified since the edit began. This feature cannot be disabled and is in place to prevent possible data loss.
 
To learn more about the most common locking issues, please review Salesforce Platform Record Locking and Concurrency(https://developer.salesforce.com/blogs/engineering/2014/07/record-locking-cheat-sheet.html).

Note: If you have already seen the error message the only option would be to make a note of the data that you modified and reload the records to enter it again, as the error message says.

Please let us know if this helps.

Mark this as solved if it's resolved.

Thanks,
Nagendra
Yamini BathulaYamini Bathula
Thanks for clarifying Nagendra.

My only concern is this is not happening in Classic Version but only in Lightning. Do we have to change anything on visualforce page to prevent this from happening?

Regards,
Yamini.
Scott KimminauScott Kimminau
Yamini Bathula, 
Did you get a fix for this? I'm having the same issue...caused because lightning does a page refresh on edit and classic does not...and in my case the controller is updating the record which is causing the collision dectection. 
Thanks!