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.

  • 1
    (8 lakhs == 800,000 for folks not using that unit)
    – David Reed
    Nov 1 '18 at 18:00
  • 3
    @DavidReed -- you got it right :)
    – Jayant Das
    Nov 1 '18 at 18:01

A few key tactics should alleviate this issue:

  1. Group your input data by WhatId to 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 Task locks the parent Who, What, and Account, so if What is not an Account, you may not be able to predict from your exported data which Account will 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.

  2. Ensure that your data loader is configured to use the Bulk API in Serial mode, rather than the default of Parallel mode.

  3. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.