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
Victor19Victor19 

Preventing multiple users in performing updates on the same record on a Visualforce page

Hi,

 

We have designed a visualforce page for a custom object using a standard SF controller. This standard controller just selects records and displays certain field values for these records along with checkboxes. We are planning on having an error recycle error process as in when a user selects a record and clicks a button the errors in the record are processed. I will be using a controller extension to perform this additional logic.

 

The issue that we may face with this process is multiple users may have the capability to perform simultaneous updates on the same record. Is there a Salesforce standard method that I can use which prevents users say: User A in performing any updates on Record A when Record A is already being processed by User B.

 

Any suggestions or feedback will greatly help me out.

 

Best Answer chosen by Admin (Salesforce Developers) 
colemabcolemab

Yes, you can use locking statements.

All Answers

colemabcolemab

Yes, you can use locking statements.

This was selected as the best answer
Victor19Victor19

Thank you!

 

I was wondering if there is any way of blocking users from the VF side. Can this be only done from the Apex side?
 

 

colemabcolemab

As far as I know, not directly in VF.  However, couldn't you render your VF page in read only mode and then when the user hits edit have the apex code re-query the record with a locking statement?  That way the record is locked until that user finishes his/her edit(s)?