Questions tagged [locking]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
30 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 ...
0
votes
0answers
30 views

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record. Case not saving: [duplicate]

I'm getting this error when trying to save a Case: Failed to invoke future method 'static void cloneCaseWithCaseProds(String, String, Set<Id>)' on class 'CTRL_Support_ProcessV2' for job id '...
4
votes
1answer
150 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
1answer
40 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
1answer
45 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
0answers
31 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 ...
0
votes
0answers
33 views

Will the product record get locked when updating or inserting quote line items?

We are updating quote line items from our triggers as well as async jobs. But somehow we get the row lock error on the product record. I don't understand the exact reason why updating the quote line ...
3
votes
1answer
200 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
1answer
28 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
1answer
23 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
1answer
54 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
0answers
53 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
2answers
164 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
0answers
56 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
1answer
216 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
1answer
83 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
1answer
33 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
1answer
54 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
1answer
616 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
2answers
313 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. ...
1
vote
0answers
45 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
1answer
2k 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 ...
1
vote
0answers
36 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 ...
1
vote
2answers
338 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
1answer
663 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
1answer
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 ...
0
votes
2answers
63 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 ...
0
votes
0answers
22 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
1answer
158 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 ...
6
votes
1answer
2k 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
vote
2answers
757 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
vote
1answer
106 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 ...
10
votes
1answer
323 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 ...
1
vote
1answer
948 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 ...
0
votes
0answers
483 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 ...
0
votes
1answer
203 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 ...
0
votes
1answer
395 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 ...
0
votes
1answer
397 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 ...
7
votes
1answer
616 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 ...
3
votes
0answers
94 views

Resolving UNABLE_TO_LOCK_ROW issue

Is there any way to identify which transaction/class took the lock the record when we get this UNABLE_TO_LOCK_ROW issue. Simply giving UNABLE_TO_LOCK error and not giving the idea about he potential ...
0
votes
1answer
852 views

how did Record lock in salesforce in my scenario and how to avoid it?

we have a scenario where User role is changes we have to update Account field then Account's trigger will update 5 related objects so their triggers also fire :) . Earlier we have used process builder ...
1
vote
1answer
111 views

Apex Approval Process Locks on DML Statements

I have a custom button on a record which is designed to update the record's status. There is a separate process within a different class, which is locking the record. I need my pageRef to unlock the ...
1
vote
1answer
556 views

Waiting for a record to be unlocked in Apex

As You know how we can lock records in Apex by adding a FOR UPDATE at the end of SOQL query. In one of my classes I have to query for a bunch of records and then updating them. In this query I use ...
1
vote
1answer
72 views

Is it possible to have a validation rule with a finely nuanced loophole to create and modify detail records?

We have Opportunity with a custom checkbox property "Locked__c". While this value is set to true (never mind how), it should be impossible to change any value on the Opportunity. The Opportunity has ...
4
votes
1answer
748 views

SObject type does not allow locking rows

I am trying to update a group of records satisfying certain conditions it was giving me Error which says:- UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record or 10 records so ...
1
vote
0answers
105 views

Challenge unlocking a list of objects in my logic

I am trying to using Approval class to lock and unlock records of an object xyz__c. When I run the below code I still see the record as locked and unable to perform update on it: List<xyz__c> ...
1
vote
1answer
1k views

Unlocking and locking a record in approval process in one Transaction

In this scenario I have two object Foo__c and zoo__c. Whenever a particular field in Foo__c is updated it should update certain fields in zoo__c object. My problem : Some of the zoo__c records can ...
2
votes
0answers
360 views

Group membership locks - Territory Hierarchy updates & Sharing recalculations

I read through the Record Locking Cheat Sheet to understand record locking concepts and have some follow-up questions: What can be the cause of Group membership locks with relevance to Territory ...
3
votes
2answers
3k views

Implicit sharing & Record locking

I am trying to understand if Implicit sharing capability can be used to avoid record locks or increasing performance of update operations on master-detail records. I am referring to this link here. ...
8
votes
2answers
731 views

GroupMember locking

For out project we need to put users into correct public groups. This happens in a trigger when a user's contact is updated, depending on some of the fields there we decided where to put a user. The ...