You need to sign in to do that
Don't have an account?
Unexpected behaviour - Error:UNABLE_TO_LOCK_ROW
Hi Folks,
I am running into an unexpected issue, I want to know how salesforce execute the Time Based Workflow queue.
Let me explain the issue in detail,
We are having some time based workflow(On Object X), which is executing 120 days before trigger runs, and this workflow is updating a Boolean Flag using field update action. This flag update causes the trigger to be fired on Object X. This trigger is inserting records for another object (lets say Y).
We are loading data of Object X (approx 800 records) using Apex Data loader (V23.0). After inserting records the Time Based Workflow Queue shows the the list of trigger actions needs to be fired before 120 days. Scheduled Date shown as "1/09/2011 12:00 AM".
I know, If the schedule date is already in past then Salesforce executes the action after records inserted.
Now, after executing all actions, I can see only 1 transaction is succedded and other are failed with error "Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []"
The error is coming at the line where I am inserting the records for Object Y.
I am using Unlimited Edition and the per hour workflow time based action limit is 1000. My record counts is less than 1000 and still I can see there are 4 entries in debug log. Out of 4 only 1 succedded and other 3 are failing with the above mentioned error.
Thanks in advance!
Is your trigger a BEFORE or AFTER?
Also can you post your code?
After Update!
Flip them to a BEFORE update - see what happens.
(not seeing your code - going on gut here...)