function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ram123ram123 

Object Level Lock ?

Just want to confirm, there is not much option to lock Object in apex during DML? i guess trigger locks the record by default during execution but not much locking option in Apex controller level ?

 

If anybody tried any work around let me know,

 

Thanks

Ram

 

SuperfellSuperfell

You can use the FOR UPDATE option on the query to lock the rows.

ram123ram123

Thanks simion

 

1. does batch process automatically locks records returned by query locator ?.

 

2. I just got this exception few times " UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record ", I'm assuming this is due to some triggers running back ground.

 

Thanks

Ram