UNABLE_TO_LOCK_ROW error during inserting a new Record











up vote
1
down vote

favorite












I am trying to insert new records in Salesforce using data loader, but getting the below error -
Error received from salesforce.com. Fields . Status code [UNABLE_TO_LOCK_ROW]. Message [unable to obtain exclusive access to this record].



I thought this happens only during update, but why it is happening in Insert










share|improve this question


















  • 1




    Possible duplicate of Can anybody explain the UNABLE_TO_LOCK_ROW error?
    – Pranay Jaiswal
    6 hours ago










  • Are you inserting child records? If child cannot get access to parent it throws that error.
    – Pranay Jaiswal
    6 hours ago















up vote
1
down vote

favorite












I am trying to insert new records in Salesforce using data loader, but getting the below error -
Error received from salesforce.com. Fields . Status code [UNABLE_TO_LOCK_ROW]. Message [unable to obtain exclusive access to this record].



I thought this happens only during update, but why it is happening in Insert










share|improve this question


















  • 1




    Possible duplicate of Can anybody explain the UNABLE_TO_LOCK_ROW error?
    – Pranay Jaiswal
    6 hours ago










  • Are you inserting child records? If child cannot get access to parent it throws that error.
    – Pranay Jaiswal
    6 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am trying to insert new records in Salesforce using data loader, but getting the below error -
Error received from salesforce.com. Fields . Status code [UNABLE_TO_LOCK_ROW]. Message [unable to obtain exclusive access to this record].



I thought this happens only during update, but why it is happening in Insert










share|improve this question













I am trying to insert new records in Salesforce using data loader, but getting the below error -
Error received from salesforce.com. Fields . Status code [UNABLE_TO_LOCK_ROW]. Message [unable to obtain exclusive access to this record].



I thought this happens only during update, but why it is happening in Insert







data access loader






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









Aritra Chakraborty

133




133








  • 1




    Possible duplicate of Can anybody explain the UNABLE_TO_LOCK_ROW error?
    – Pranay Jaiswal
    6 hours ago










  • Are you inserting child records? If child cannot get access to parent it throws that error.
    – Pranay Jaiswal
    6 hours ago














  • 1




    Possible duplicate of Can anybody explain the UNABLE_TO_LOCK_ROW error?
    – Pranay Jaiswal
    6 hours ago










  • Are you inserting child records? If child cannot get access to parent it throws that error.
    – Pranay Jaiswal
    6 hours ago








1




1




Possible duplicate of Can anybody explain the UNABLE_TO_LOCK_ROW error?
– Pranay Jaiswal
6 hours ago




Possible duplicate of Can anybody explain the UNABLE_TO_LOCK_ROW error?
– Pranay Jaiswal
6 hours ago












Are you inserting child records? If child cannot get access to parent it throws that error.
– Pranay Jaiswal
6 hours ago




Are you inserting child records? If child cannot get access to parent it throws that error.
– Pranay Jaiswal
6 hours ago










1 Answer
1






active

oldest

votes

















up vote
5
down vote













There are lots of situations where an insert can cause a record lock against the parent of the inserted record, or even against third records. Inserting Task, for example, can lock the WhoId, WhatId, and AccountId.



The Record Locking Cheat Sheet is an excellent guide to what facets of your data have the highest likelihood of lock contention.



Fixing this error is generally heuristic - you need to understand the cause of the underlying issue and then apply one or more techniques to minimize the locking risk, but there's no switch you can throw to make it go away.



The two techniques that are often applicable are




  • Order your incoming data by parent record Id, to prevent records in different batches from contending for the lock on the parent.

  • Ensure that the Data Loader is configured to utilize the Bulk API in Serial mode, rather than Parallel mode.


In many cases (such as when a record has exactly one parent) you won't need to do both, just one or the other. Situations with extreme data skew and records that have more than one parent are more complex, however.



Depending on the situation, it's possible you might have to undertake more drastic interventions, like scheduling a maintenance window to prevent users from themselves seeking to work with affected records, or disabling triggers and other automation on the records you're importing.



Spend some time with the locking cheat-sheet to identify your core issue first, though, and try each of the two points above first before you go that far.






share|improve this answer























  • bookmarking that cheat sheet posthaste
    – Derek F
    6 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242143%2funable-to-lock-row-error-during-inserting-a-new-record%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
5
down vote













There are lots of situations where an insert can cause a record lock against the parent of the inserted record, or even against third records. Inserting Task, for example, can lock the WhoId, WhatId, and AccountId.



The Record Locking Cheat Sheet is an excellent guide to what facets of your data have the highest likelihood of lock contention.



Fixing this error is generally heuristic - you need to understand the cause of the underlying issue and then apply one or more techniques to minimize the locking risk, but there's no switch you can throw to make it go away.



The two techniques that are often applicable are




  • Order your incoming data by parent record Id, to prevent records in different batches from contending for the lock on the parent.

  • Ensure that the Data Loader is configured to utilize the Bulk API in Serial mode, rather than Parallel mode.


In many cases (such as when a record has exactly one parent) you won't need to do both, just one or the other. Situations with extreme data skew and records that have more than one parent are more complex, however.



Depending on the situation, it's possible you might have to undertake more drastic interventions, like scheduling a maintenance window to prevent users from themselves seeking to work with affected records, or disabling triggers and other automation on the records you're importing.



Spend some time with the locking cheat-sheet to identify your core issue first, though, and try each of the two points above first before you go that far.






share|improve this answer























  • bookmarking that cheat sheet posthaste
    – Derek F
    6 hours ago















up vote
5
down vote













There are lots of situations where an insert can cause a record lock against the parent of the inserted record, or even against third records. Inserting Task, for example, can lock the WhoId, WhatId, and AccountId.



The Record Locking Cheat Sheet is an excellent guide to what facets of your data have the highest likelihood of lock contention.



Fixing this error is generally heuristic - you need to understand the cause of the underlying issue and then apply one or more techniques to minimize the locking risk, but there's no switch you can throw to make it go away.



The two techniques that are often applicable are




  • Order your incoming data by parent record Id, to prevent records in different batches from contending for the lock on the parent.

  • Ensure that the Data Loader is configured to utilize the Bulk API in Serial mode, rather than Parallel mode.


In many cases (such as when a record has exactly one parent) you won't need to do both, just one or the other. Situations with extreme data skew and records that have more than one parent are more complex, however.



Depending on the situation, it's possible you might have to undertake more drastic interventions, like scheduling a maintenance window to prevent users from themselves seeking to work with affected records, or disabling triggers and other automation on the records you're importing.



Spend some time with the locking cheat-sheet to identify your core issue first, though, and try each of the two points above first before you go that far.






share|improve this answer























  • bookmarking that cheat sheet posthaste
    – Derek F
    6 hours ago













up vote
5
down vote










up vote
5
down vote









There are lots of situations where an insert can cause a record lock against the parent of the inserted record, or even against third records. Inserting Task, for example, can lock the WhoId, WhatId, and AccountId.



The Record Locking Cheat Sheet is an excellent guide to what facets of your data have the highest likelihood of lock contention.



Fixing this error is generally heuristic - you need to understand the cause of the underlying issue and then apply one or more techniques to minimize the locking risk, but there's no switch you can throw to make it go away.



The two techniques that are often applicable are




  • Order your incoming data by parent record Id, to prevent records in different batches from contending for the lock on the parent.

  • Ensure that the Data Loader is configured to utilize the Bulk API in Serial mode, rather than Parallel mode.


In many cases (such as when a record has exactly one parent) you won't need to do both, just one or the other. Situations with extreme data skew and records that have more than one parent are more complex, however.



Depending on the situation, it's possible you might have to undertake more drastic interventions, like scheduling a maintenance window to prevent users from themselves seeking to work with affected records, or disabling triggers and other automation on the records you're importing.



Spend some time with the locking cheat-sheet to identify your core issue first, though, and try each of the two points above first before you go that far.






share|improve this answer














There are lots of situations where an insert can cause a record lock against the parent of the inserted record, or even against third records. Inserting Task, for example, can lock the WhoId, WhatId, and AccountId.



The Record Locking Cheat Sheet is an excellent guide to what facets of your data have the highest likelihood of lock contention.



Fixing this error is generally heuristic - you need to understand the cause of the underlying issue and then apply one or more techniques to minimize the locking risk, but there's no switch you can throw to make it go away.



The two techniques that are often applicable are




  • Order your incoming data by parent record Id, to prevent records in different batches from contending for the lock on the parent.

  • Ensure that the Data Loader is configured to utilize the Bulk API in Serial mode, rather than Parallel mode.


In many cases (such as when a record has exactly one parent) you won't need to do both, just one or the other. Situations with extreme data skew and records that have more than one parent are more complex, however.



Depending on the situation, it's possible you might have to undertake more drastic interventions, like scheduling a maintenance window to prevent users from themselves seeking to work with affected records, or disabling triggers and other automation on the records you're importing.



Spend some time with the locking cheat-sheet to identify your core issue first, though, and try each of the two points above first before you go that far.







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 6 hours ago









David Reed

28k61746




28k61746












  • bookmarking that cheat sheet posthaste
    – Derek F
    6 hours ago


















  • bookmarking that cheat sheet posthaste
    – Derek F
    6 hours ago
















bookmarking that cheat sheet posthaste
– Derek F
6 hours ago




bookmarking that cheat sheet posthaste
– Derek F
6 hours ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242143%2funable-to-lock-row-error-during-inserting-a-new-record%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo