Questions tagged [locking]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
0 answers
43 views

Safely replace a packaged Master-Detail with Lookup

My active 1GP Managed Package app suffers from Account and Data skew (with ROW LOCKING) because we made a custom object AccountItem__c a child in a Master-Detail relation (MDR) ship with Account. As ...
user avatar
6 votes
0 answers
89 views

Transactions Committed After Lock Not Queryable?

I have created a function that is: Run every hour in a batch job. May be called on demand. May be called on-demand by a webservice method. It is summarised as follows: Lock the parent records. ...
user avatar
  • 61
0 votes
0 answers
17 views

Inconsistent InsertDE /Lookup AmpScript results during Email send (locking?)

I'm developing a global Marketing Cloud log which logs the assetID each send job utilizes, but having inconsistent results with being able to write and then retrieve a value within the same send. The ...
user avatar
2 votes
0 answers
42 views

Custom setting insertion contributing to Lock Row exception which finally causes to ConcurrentLongRunning Transactions

We recently faced ConcurrentLongRunning exceptions in our org. We resolved a few rest entry points which SF Support team suggested but few I am not sure if SF Support team analysis is correct. We have ...
user avatar
1 vote
1 answer
42 views

How to update records which also are updated by by batch process

We currently have a batchprocess running from a managed package which runs every day for almost the whole day to update records of an object. When a user tries to do an update on this object we have a ...
user avatar
  • 2,068
2 votes
2 answers
311 views

Is a SOQL query with FOR UPDATE enough to safely delete a record?

I have a scenario where an external system is calling the Salesforce API, causing a trigger to run. That trigger needs to delete EmailMessage records where the RelatedTo field is an Account. We're ...
user avatar
  • 12.7k
0 votes
0 answers
91 views

I would like to just copy the data from formula field(related to user role) to a text field in opportunity so I could lock the opp when closed

I have formula filed Region which is calculated from user role. This field being formula field is dynamic and is changed every time owner of the Opportunity changes his role in a org. Since its a ...
user avatar
  • 113
0 votes
1 answer
37 views

A non-admin user claims she was able to edit a record which is programmatically locked but now she cannot

As far as I know a programmatically locked record can only be edited by an admin user and current situation seems normal to me. Note: Locking is also done from a component she uses. This is the only ...
user avatar
  • 27
-1 votes
1 answer
928 views

This error occurred: UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record

I know there are a lot of topics about lock issues, but I couldn't find one which relates to my case. I have field DaysInTarget__c, which is updated daily when an opportunity is in Target stage. Also ...
user avatar
1 vote
1 answer
41 views

How to replicate a UNABLE_TO_LOCK_ROW error in a unit test

We've been seeing the UNABLE_TO_LOCK_ROW issue in our prod org. I've created a retry for DML actions facing this issue to sleep for a certain number of milliseconds between each try and try for a ...
user avatar
  • 574
1 vote
1 answer
34 views

Remove rollups to reduce lock time?

We have some occasional row lock errors. The object in question has a master-detail relationship to Account, and another custom child relationship as well. So three objects linked together via master-...
user avatar
  • 632
1 vote
0 answers
74 views

UNABLE_TO_LOCK_ROW error on user object triggered by platform event trigger only during deployment of destructiveChanges.xml

We have a platform event trigger that fires when users login. It fires hundreds of times per week and does not throw any errors. Three times in the past week, it has thrown an UNABLE_TO_LOCK_ROW ...
user avatar
  • 4,203
0 votes
1 answer
69 views

Initial submitter can edit and reject records in approval process

I have a user (or any user in fact), who has a Standard salesforce profile, IE not a System Admin profile, who's able to edit and even reject opportunities that he submitted. He should not be able to ...
user avatar
  • 43
0 votes
1 answer
141 views

Record not getting locked using Approval.lock apex

My requirement is to make a record read only when value of a field changes to 'Inactive'. I read that records can be locked using approval.lock in Apex. Hence, I was trying to use Approval.lock record ...
user avatar
4 votes
1 answer
424 views

Do Master Records (in a Master-detail Relationship) Get Locked?

Suppose the following: There's a master-detail relationship between two custom objects There are no roll-up summary fields on the master object There are no declarative automations or Apex triggers ...
user avatar
  • 664
0 votes
1 answer
306 views

Custom Text field is not editable in Edit layout

I have added a custom field to the edit layout of the Order Product object, which appears after I click on Add Products button on the Order record page, in the Order products-related list. But I am ...
user avatar
0 votes
1 answer
134 views

Can SELECT FOR UPDATE release before transaction end?

As per Salesforce documents, I understand that when using SELECT FOR UPDATE the records will not released until the end of transaction. I use SELECT FOR UPDATE but still find error UNABLE_TO_LOCK_ROW ...
user avatar
  • 1
2 votes
0 answers
46 views

Exposing IsLocked Field in Scratch Orgs

I'm in the process of converting an existing project to leverage Scratch Orgs. Our Production Org uses Approval Processes extensively, and so we have some Apex that does record unlocking and locking ...
user avatar
3 votes
1 answer
293 views

Does Database.rollback on a savepoint release Select for Update locks

I'm trying to understand Salesforce's locking mechanism. I ran a test which does the following: Calls Database.setSavepoint(). Issues a Select for Update query. Calls Database.rollback(savepoint). ...
user avatar
0 votes
1 answer
36 views

Apex - send Account Unlock email

Is there a way to trigger the account unlock emails via Apex? I'm trying to setup a self-service solution where users can enter their username via a form and get the account unlock email, instead of ...
user avatar
0 votes
1 answer
37 views

Need to set the custom object's list view records un-editable

I have a custom object list view .In that list view some column records should not be editable.is there any way to achieve that .Thanks..:)
user avatar
  • 5
0 votes
1 answer
60 views

Unusual Request: Prevent Navigation away from Opportunity

I've never been asked this before, and from what I've seen there isn't much out there. Problem Users are not completing their tasks on an opportunity before moving to the next sales opportunity or ...
user avatar
  • 1,248
0 votes
0 answers
228 views

UNABLE_TO_LOCK_ROW

Error while saving Quote Lines:SBQQ.ValidationException: [": execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable ...
user avatar
4 votes
2 answers
251 views

SOQL - concurrent reads of rows when FOR UPDATE clause is used

Below is our scenario: We have a requirement to tag unique number to self service applications which are created through customer community. We tried to use salesforce auto number but our client had ...
user avatar
  • 7,521
4 votes
0 answers
61 views

Is this a good Model for "Guaranteeing" Record Updates Don't Fail due to ROW_LOCK/Race Conditions?

Background: The zqu__Quote__c object in our org has two child objects from another managed package we use for eSignature and credit card capture. One of those two child objects collects the Credit ...
user avatar
3 votes
1 answer
351 views

Does locking of account lock related contact during insert?

I have a WSDL Apex service that consumes XML and creates a series of objects. XML received and parsed, queries for and finds a single account "Potential Customer" to relate potential customer ...
user avatar
  • 1,808
4 votes
1 answer
158 views

Is there a way to prevent SOQL from returning records that have been locked with FOR UPDATE?

If I have a class that is using FOR UPDATE to lock a record. Is there a way to prevent another instance of that class from calling those records that have been locked before the previous class is done ...
user avatar
1 vote
1 answer
39 views

Is there any locking of cases or delay in CRUD operations after updating case assignment rules?

If I update case assignment rules are there any locking or differences such as query delays that I should consider? The documentation does not specifically list update assignment rule considerations ...
user avatar
  • 1,808
3 votes
1 answer
63 views

Does the FOR UPDATE field apply to reference fields?

If do a query like [SELECT Opportunity.Name, Product2.Name FROM OpportunityLineItem FOR UPDATE], is the Opportunity and Product2 locked, or just the OpportunityLineItem? I'm trying to set a field on ...
user avatar
4 votes
1 answer
882 views

Avoid new record race conditions with FOR UPDATE [closed]

Under simple circumstances FOR UPDATE does only respect records that existed when the query was executed. But I need all available records matching my query when the transaction proceeds. Let me ...
user avatar
  • 6,100
5 votes
2 answers
454 views

Spin locks with variable time retry backoffs

Use Case After insert triggers start Queueable Queueable execute() contends for same resource, uses spin lock to wait for resource availability. Many queueables could be running at same time. ...
user avatar
  • 61.4k
1 vote
0 answers
51 views

Locking Attachment During Approval Process is failing

I am trying to lock the Attachments related to a custom object using the below 2 lines of code, when the custom record is under approval process. But I am getting an error as: "System....
user avatar
4 votes
1 answer
4k views

Bulk API Error: UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record or 124 records

During the process of loading 90,000 opportunities into Salesforce using the Bulk API, I get this error: UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record or 124 records... After ...
user avatar
  • 8,213
1 vote
0 answers
40 views

Record Lock Issue for REST endpoint

I have built a REST endpoint, which writes data(Accounts) to Salesforce. Currently, for a single record, there could be multiple (20-30 times) upserts within 1-to-5 seconds. Behind the scenes, it's a ...
user avatar
  • 2,233
1 vote
2 answers
457 views

User hits record lock error despite class without sharing

My users keep hitting a record lock error despite the class being defined as without sharing. My understanding is that without sharing allows locked records to be edited by any user. This class is the ...
user avatar
7 votes
1 answer
878 views

Apex Approval.lock, programmatic locking and record editability

Background: In Winter '16, Salesforce introduced the Approval class for setting approval locks and unlocks through Apex (release notes). Since then, my company has been leveraging this functionality ...
user avatar
0 votes
1 answer
1k views

Records are not getting locked with "Approval.LockResult" class

On Using "Approval.LockResult" class, In debug logs i can see the records are successfully locked but in reality the records are not saved and i cannot even see the lock/unlock button on record detail ...
user avatar
0 votes
2 answers
104 views

Locking rows at the last minute

I have a utility routine (pasted below) that I use for all writes to the database which lets me catch errors. This works perfectly in all but one of my orgs. In that org, I generate a ton of ...
user avatar
  • 504
0 votes
0 answers
23 views

Validation Rule to "Lock Up" UTM Fields on Opportunity when the Opportunity is created [duplicate]

I am trying to lock the UTM fields on an opportunity when it is created. I would the field to not be able to be edited by anyone (including Marketo Sync User) other than a system admin after the ...
user avatar
0 votes
1 answer
221 views

Tasks Updates--Locking issue

We are currently facing issue while updating tasks via dataloader or workbench. We are updating tasks of around 8 lakhs. Problem is tasks are linked to account which locks the accounts while updating ...
user avatar
7 votes
1 answer
3k views

Users getting "Unable to obtain exclusive access" Error

My users are attempting to work in records and occasionally get the error message of Unable to obtain exclusive access to this record or 1 records: [id]. This error is intermittent and I cannot find ...
user avatar
  • 1,020
1 vote
2 answers
1k views

Salesforce Bulk API Unable to lock row

I'm currently using the Salesforce Bulk API within a Rails app to update a custom object in Salesforce. This works fine when I send a single record through, but when I batch in sets of 200, I get ...
user avatar
  • 1,226
1 vote
1 answer
119 views

Process multiple inbound requests in parallel

I have an inbound interface in my Salesforce org, it updates existing account records. The inbound interface being called by number of third party systems. Whenever two different requests try to same ...
user avatar
10 votes
1 answer
462 views

FOR UPDATE returns old values

I use FOR UPDATE locking in a query but when the first execution completed, the second execution (started while records were locked) seems to use the old data set. I played around for a while and ...
user avatar
  • 6,100
1 vote
1 answer
1k views

Lock and Unlock opportunity object during approval process

I have an approval process for the Opportunity object. But I want to unlock a record during this process to add a very important information that can only be obtained later and then lock the record ...
user avatar
  • 125
0 votes
0 answers
583 views

Unable to lock row - Record currently unavailable error

I know there has been lot of things available online for record locking errors but I am putting my analysis based on client issue that we are facing, would appreciate if I can get any thoughts. We ...
user avatar
1 vote
1 answer
300 views

How to skip transaction locked record in SOQL

Consider multiple processes are accessing a set of frequently updating records and they pick whatever matches certain criteria. They should lock those picked up records. So almost at the same time if ...
user avatar
0 votes
1 answer
531 views

UNABLE_TO_LOCK_ROW during send email

I have a code where I send email using single email message. I am setting targetObjectId as a contact Id. I am getting the following error: System.EmailException: SendEmail failed. First ...
user avatar
0 votes
1 answer
690 views

Relock record after approval process

Is there a way to re-lock a record immediately after it has been approved via an Approval Process (in the same transaction)? It seems like a simple thing to do via a Trigger but I have an After ...
user avatar
  • 331
8 votes
1 answer
697 views

Optimistic locking when working via REST API

I have a case when SF data can be updated concurrently by humans with UI and by a Ruby app via REST API, so I'm worried about the possibility they overwrite changes of each other. Is there a standard ...
user avatar
  • 195