Questions tagged [locking]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
29 views

How do I test record locking?

Say I want to prove to myself that when I delete a detail record, the master record is locked. How would I do that?
-2 votes
0 answers
19 views

how to lock opportunity when a task is open in salesforce? [closed]

how to lock opportunity when a task is open in salesforce?
0 votes
0 answers
26 views

Updating date value for open records at the start of each month

I have a flow that is designed to update a record at the start of each month if the record remains open. I.e. Billing Month = 1 August, come Sept if that record status is still "Open" then ...
0 votes
1 answer
34 views

Can multiple async methods updating same record can create row lock issue

Does multiple asynchronous process like Queueable, future etc running concurrently that are updating same record create row lock issues. We are facing row lock issues in async transactions that ...
0 votes
0 answers
26 views

Prevent user from editing a record from edit screen layout but allow apex to change the record

We have a use case where we want to prevent users from editing opportunity from edit screen once certain criteria is met but would to allow apex to make any changes to the record. Meaning, if a user ...
  • 25
0 votes
0 answers
62 views

UNABLE_TO_LOCK_ROW too soon

According to Salesforce's documentation a transaction can wait for up to 10 seconds before throwing an exception with the code "UNABLE_TO_LOCK_ROW". Yet I get the following scenario: ...
  • 1
3 votes
1 answer
235 views

Is "FOR UPDATE" available in dynamic SOQL?

The SOQL doc states that FOR UPDATE is available for inline SOQL To lock a set of sObject records in Apex, embed the keywords FOR UPDATE after any inline SOQL statement. For example, the following ...
  • 63.8k
2 votes
0 answers
95 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 ...
6 votes
0 answers
90 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. ...
  • 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 ...
2 votes
0 answers
60 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 ...
1 vote
1 answer
164 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 ...
  • 2,194
2 votes
2 answers
641 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 ...
  • 13k
0 votes
0 answers
177 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 ...
  • 113
0 votes
1 answer
96 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 ...
  • 33
-1 votes
1 answer
3k 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 ...
1 vote
1 answer
60 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 ...
  • 640
1 vote
1 answer
83 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-...
  • 642
1 vote
0 answers
150 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 ...
  • 4,275
0 votes
1 answer
219 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 ...
  • 53
0 votes
1 answer
319 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 ...
4 votes
1 answer
538 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 ...
  • 674
0 votes
1 answer
504 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 ...
0 votes
1 answer
178 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 ...
  • 1
2 votes
0 answers
52 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 ...
3 votes
1 answer
357 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). ...
0 votes
1 answer
55 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 ...
0 votes
1 answer
44 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..:)
  • 5
0 votes
1 answer
62 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 ...
  • 1,318
0 votes
0 answers
413 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 ...
4 votes
2 answers
308 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 ...
  • 7,635
4 votes
0 answers
65 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 ...
3 votes
1 answer
454 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 ...
  • 1,899
4 votes
1 answer
223 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 ...
1 vote
1 answer
43 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 ...
  • 1,899
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 ...
4 votes
1 answer
999 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 ...
  • 6,170
5 votes
2 answers
523 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. ...
  • 63.8k
1 vote
0 answers
59 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....
4 votes
1 answer
5k 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 ...
  • 8,480
1 vote
0 answers
41 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 ...
  • 2,253
1 vote
2 answers
542 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 ...
7 votes
1 answer
1k 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 ...
0 votes
1 answer
2k 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 ...
0 votes
2 answers
139 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 ...
  • 524
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 ...
0 votes
1 answer
265 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 ...
7 votes
1 answer
4k 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 ...
  • 1,018
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 ...
  • 1,236
1 vote
1 answer
122 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 ...