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 tasks. we run out of record locking issue. We want to scramble the records in the tasks so we want to update them. Can any body provide some suggestion to bypass this locking issue.
A few key tactics should alleviate this issue:
Group your input data by
WhatIdto ensure that the Tasks for each Account are grouped into as few batches as possible.
Note that this might not actually be enough - updating a
Tasklocks the parent
Account, so if
Whatis not an
Account, you may not be able to predict from your exported data which
Accountwill be locked. See Record Locking Cheat Sheet and Calculation of the Account ID of an activity . You might also have to contend with lock contention from the
WhoId, depending upon the smoothness of the distribution of your Tasks across their parents. This is an area with a high risk of lock contention.
Ensure that your data loader is configured to use the Bulk API in Serial mode, rather than the default of Parallel mode.
Additionally, you should ensure that no other data loads, processes, or user activities are updating these Accounts or related objects. For a load of this size with this much locking risk, you may wish to schedule a maintenance window so your users are not entering new Tasks.
The error fundamentally comes from multiple Salesforce transactions attempting to lock the Account simultaneously; all mitigation strategies center on reducing the parallel actions affecting the same records at the same time.