How do you implement the locking functionality of records in apex ?



How do you implement the locking functionality of records in apex ?..

Answer / Ajit Puniya

In Apex, you can use Database.Lock() method to implement record locking. This allows you to acquire a write lock on a specific record, preventing other transactions from modifying it until the lock is released. To acquire a lock, call Database.Lock(Id recordId, LockType type) and specify the Id of the record and the desired lock type.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Salesforce Interview Questions

What are differences between custom settings and custom objects?

1 Answers  


What is an Auto-Response Rule?

1 Answers  


Define a custom object in salesforce?

1 Answers  


Explain the difference between trigger.new and trigger.newmap?

1 Answers  


What are Folders?

1 Answers  


Explain the skinny table. What are the considerations for skinny table?

1 Answers  


Is it possible to skip steps in approval process? : salesforce workflows and approval process

1 Answers  


Can we implement multilevel approval process in salesforce? : salesforce workflows and approval process

1 Answers  


Explain what do you understand by data skew in salesforce.

1 Answers  


What is the difference between public and global class in apex? : salesforce crm

1 Answers  


Explain batch apex?

1 Answers  


Is it possible to create parallel approval process (ability for multiple user to approve or reject a record)? : salesforce workflows and approval process

1 Answers  


Categories