Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [locking]

The tag has no usage guidance.

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

Unable to lock row or deadlock issue

We have over 200 test methods in the org and since I started creating some test classes for my own Sandbox I have ran into issues with the following error but may vary by method: System.DmlException: ...
MrKnudz's user avatar
  • 13
0 votes
0 answers
35 views

Is it possible to reliably determine that a QueryException in Apex is a Row Lock Exception?

I'd like to create a standard in my company for handling concurrency in asynchronous processes. For this I need to reliably detect a row locking exception and differentiate it from any other kind of ...
Richard Corfield's user avatar
0 votes
1 answer
47 views

System.QueryException: Record Currently Unavailable

Im getting the following error: caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by ...
Thomas's user avatar
  • 2,298
0 votes
1 answer
71 views

Campaign Record Lock After Status Update

I want to "Lock" Campaign records for standard users once the Status field is changed to Completed, by the record owner. After it has been changed, the standard user should not be able to ...
Ron's user avatar
  • 21
0 votes
1 answer
550 views

Record is not getting locked in via Approval Process

We have enabled a approval process with initial action as "Lock the Record", once the record is submitted on criteria met in the field history we could see the record is locked. But in the ...
Rajasekhar's user avatar
  • 1,601
-1 votes
1 answer
79 views

Record Lock in salesforce

How to record lock once status is completed as per UI, but in backend using automation process we can like roll up field ,record can be updated
Deepsikha Rajpoot's user avatar
0 votes
0 answers
65 views

Recalling and Invoking Approval Process record locking is inconsistent

I’m facing one weird consistency issue in locking / unlocking of records on Recalling Approval process and invoking the same Approval process again. I have a requirement where on click of LWC Action ...
AjaySFDC's user avatar
  • 618
0 votes
0 answers
391 views

ENTITY_IS_LOCKED error, when ProcessInstanceWorkitem is reassigned in the Apex code

we have logic, that reassigns approval request in the code. This logic is executed in the batch and base on some conditions on the record reassigns Approval Request to different Approver. public ...
Jakub Godlewski's user avatar
1 vote
0 answers
816 views

Generic way to handle record locking errors in a flow?

We have locking errors when creating records (e.g. a contact locks on household) or updating records with flows. As this is a common problem I was wondering why there is no generic APEX Action that ...
Phlogi's user avatar
  • 111
0 votes
0 answers
139 views

Filter Criteria or Decision Element in a Record Triggered Flow using an Update Record element

After some advice on the best practice approach to updating records in a Flow. I have a few flows that sum values of related records and update the parent with that summed value. I have set up the ...
Simon Baird's user avatar
-1 votes
1 answer
368 views

How to implement read lock on record in salesforce?

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 ...
ZeroX's user avatar
  • 21
2 votes
0 answers
518 views

How does Record locking behave in master-detail-sub-detail hierarchy?

In the ERD below all the objects are linked by MDR. If I update a record in detail 3 I understand that detail 2 would get locked. Would detail 1 and master get locked as well? How would I test this?
PartOfTheOhana's user avatar
0 votes
1 answer
117 views

What are possible side effects of having fields on User object which should be frequently updated?

For integration purposes I would like to store a few custom fields on User object which should be updated 10-30 times per day. Is it considered a good practice to have such fields on User object? Are ...
Taras Shevchuk's user avatar
5 votes
0 answers
118 views

Stress-test and prove limit-scalability of Asynchronous code

Giving my question a proper title was hard as I am only partially sure what I am actually looking for - solution-wise. In our fully native (no AWS or Functions backend) Managed Package many ...
Robert Sösemann's user avatar
1 vote
1 answer
319 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?
PartOfTheOhana's user avatar
0 votes
1 answer
519 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 ...
sfdeveloper's user avatar
1 vote
0 answers
226 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: ...
alozzi's user avatar
  • 11
3 votes
1 answer
779 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 ...
cropredy's user avatar
  • 71.7k
2 votes
0 answers
364 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 ...
Robert Sösemann's user avatar
6 votes
0 answers
109 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. ...
Sean's user avatar
  • 61
0 votes
0 answers
50 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 ...
Luishi5000's user avatar
2 votes
0 answers
209 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 ...
Nagendra Singh's user avatar
1 vote
1 answer
351 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 ...
Thomas's user avatar
  • 2,298
3 votes
2 answers
1k 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 ...
Aidan's user avatar
  • 13.7k
0 votes
0 answers
479 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 ...
tough's user avatar
  • 123
0 votes
1 answer
181 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 ...
pt_5858's user avatar
  • 45
0 votes
1 answer
17k 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 ...
Vonahclom's user avatar
1 vote
1 answer
357 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 ...
Bahman.A's user avatar
  • 858
1 vote
1 answer
603 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-...
JimG's user avatar
  • 743
1 vote
0 answers
364 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 ...
gorav's user avatar
  • 4,537
0 votes
1 answer
739 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 ...
Cory_16's user avatar
  • 63
0 votes
1 answer
1k 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 ...
Avinash Kumar's user avatar
6 votes
1 answer
1k 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 ...
M H's user avatar
  • 779
0 votes
1 answer
1k 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 ...
Akshay Vasu's user avatar
0 votes
1 answer
367 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 ...
R์NK's user avatar
  • 1
2 votes
0 answers
87 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 ...
Anthony Sanchez's user avatar
3 votes
2 answers
632 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). ...
silverglass's user avatar
0 votes
1 answer
99 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 ...
miCRoSCoPiC_eaRthLinG's user avatar
0 votes
1 answer
83 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..:)
Dinesh's user avatar
  • 5
0 votes
1 answer
76 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 ...
thinker's user avatar
  • 1,430
0 votes
0 answers
613 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 ...
Nirav Shah's user avatar
4 votes
2 answers
534 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 ...
RedDevil's user avatar
  • 7,821
4 votes
0 answers
85 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 ...
Morgan Marchese's user avatar
3 votes
1 answer
836 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 ...
S.B.'s user avatar
  • 2,071
4 votes
1 answer
430 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 ...
Dan Donin's user avatar
1 vote
1 answer
71 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 ...
S.B.'s user avatar
  • 2,071
3 votes
1 answer
101 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 ...
just_chilling's user avatar
4 votes
1 answer
1k 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 ...
itsmebasti's user avatar
  • 6,437
5 votes
2 answers
868 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. ...
cropredy's user avatar
  • 71.7k
2 votes
0 answers
81 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....
Sajith Mohanan's user avatar