We have a requirement to implement the read lock on record such that no other transaction can read that record until the first transaction is completed or committed and other transaction have to wait until the first transaction is completed. Is this possible in Salesforce?

  • 2
    Check the FOR UPDATE keywords.
    – Phil W
    Commented Feb 6, 2023 at 12:51
  • .@PhilW I think For update lock other transaction to update the record but other transaction can read the record , but I want that other transaction don't read the record until first transaction is completed.
    – ZeroX
    Commented Feb 6, 2023 at 13:16

1 Answer 1


The FOR UPDATE keywords allow you to query records only if they are not already locked, as covered but the second "Locking Consideration" in the documentation.

The important points from these considerations here are:

Other clients can still query the same records while they’re locked.


If you attempt to lock a record currently locked by another client, your process waits a maximum of 10 seconds for the lock to be released before acquiring a new lock.

So as long as both clients are using FOR UPDATE in their queries you effectively get read locking. It is only when clients are using a mix of with and without FOR UPDATE that you don't get a read lock.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .