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
RadnipRadnip 

Concurrency/record locking on the REST API?

Do you get the Salesforce concurrency/record locking when your using the REST API? I'm assuming not.

sfdcfoxsfdcfox
Record locking works with the REST API the same as it does with any other interface to salesforce.com. It's true that it's possible for a REST API call to overwrite another's changes during a query -> do something -> update cycle, but if two edits reach the database at the same time, one of them will get the usual UNABLE_TO_OBTAIN_ROW_LOCK error. This is easily noticeable when there are long transactions that occur on the record so you can test it (for example, creating a trigger that locks up the transaction for 7-8 seconds, you can launch a second update that will fail). The UI also respects row locking, and will notify a user when a change has been made to a record while they were working on it in order to avoid overwriting the data.