Questions tagged [locking]
The locking tag has no usage guidance.
124
questions
0
votes
1
answer
49
views
Using Flow, is there a way to update a single field only for all records in a collection of records
I want to update a single field in a collection of Account records. In the Update Records Element, the only option that accepts a collection is 'Use the IDs and all field values from a record or ...
0
votes
0
answers
132
views
UNABLE_TO_LOCK_ROW on ContentFolder when attempting to create ContentDocument
Recently the primary admin user of a production org has intermittently different types of jobs and batches failing with the following error:
"First error: Insert failed. First exception on row 0;...
0
votes
1
answer
77
views
Avoid parent record locking
Our customer are using the standards apis to insert record of different types that have the same parent record.
UPDATE : Two of these records are the detail record of a MDR while the others are linked ...
1
vote
1
answer
95
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: ...
0
votes
0
answers
56
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 ...
0
votes
1
answer
56
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 ...
0
votes
1
answer
106
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
892
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
97
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
1
vote
0
answers
1k
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
215
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 ...
-1
votes
1
answer
449
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
768
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
181
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
129
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
374
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
600
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
244
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
833
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
418
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
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.
...
0
votes
0
answers
56
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
217
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
410
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
493
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
189
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
20k
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
492
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
690
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
382
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
825
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
388
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
92
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
2
answers
712
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
109
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
89
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
85
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
628
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
571
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
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 ...
3
votes
1
answer
894
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
467
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
74
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
102
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
904
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.
...