I am trying to insert a list of task records on a case using Node.js.

I am getting this error after inserting 4-5 records. I am doing this as a bulk operation.

UNABLE_TO_LOCK_ROW: unable to obtain exclusive access to this record.

conn1.sobject("Task").create(TaskRecords, function(err, rets) {
                    if (err ) { console.log(err); }
                    for (var i=0; i < rets.length; i++) {
                        if (rets[i].success) {
                          console.log("Created record id : " + rets[i].id);

1 Answer 1


During a create, the parent record (e.g. the WhoId and WhatId records) must be locked first. This error means that the record was not available to be locked, presumably because a DML operation or an Apex Code class has already locked the record. When you get this error, you simply need to try again later.

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.