Questions tagged [locking]
The locking tag has no usage guidance.
123
questions
0
votes
1
answer
32
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 ...
0
votes
1
answer
143
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 ...
-1
votes
1
answer
54
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
0
votes
0
answers
40
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 ...
0
votes
0
answers
120
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 ...
0
votes
0
answers
55
views
How to get rid of 'UNABLE_TO_LOCK_ROW' while deleting multiple Group Members from a Group
I'm working on a scheduled flow which will delete all the Group Members present in a group after which I can add the required Group Members. But when the flow runs in scheduled mode it throws an error ...
0
votes
0
answers
415
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 ...
0
votes
0
answers
60
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 ...
0
votes
0
answers
292
views
How to prevent record lock errors when performing DML on Custom Settings
I am looking for some insight in how to avoid a record lock error in one of my Apex classes that is doing a couple of updates on a custom setting.
The way that our org is set up is that we have a user ...
-1
votes
1
answer
235
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 ...
2
votes
0
answers
291
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?
0
votes
1
answer
65
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 ...
5
votes
0
answers
115
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 ...
1
vote
1
answer
225
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?
0
votes
1
answer
422
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 ...
1
vote
0
answers
202
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:
...
3
votes
1
answer
645
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 ...
2
votes
0
answers
296
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
106
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.
...
0
votes
0
answers
41
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
195
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
292
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 ...
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 ...
0
votes
0
answers
434
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 ...
0
votes
1
answer
171
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 ...
0
votes
1
answer
12k
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
240
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 ...
1
vote
1
answer
397
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-...
1
vote
0
answers
321
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 ...
0
votes
1
answer
602
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 ...
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 ...
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 ...
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 ...
0
votes
1
answer
331
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 ...
2
votes
0
answers
80
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
552
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
88
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
73
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..:)
0
votes
1
answer
66
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 ...
0
votes
0
answers
589
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
471
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 ...
4
votes
0
answers
79
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
727
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 ...
4
votes
1
answer
371
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
62
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 ...
3
votes
1
answer
94
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
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 ...
5
votes
2
answers
785
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.
...
2
votes
0
answers
80
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....
6
votes
1
answer
7k
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 ...