+ Start a Discussion
Emily Johnson 23Emily Johnson 23 

Clone record with jsforce

Does anyone have an example of cloning a record using jsforce? I have attempted tihs a few different ways. The (very limited) resources I've found refer to using _.clone(record) but I am getting a circular reference error so I'm sure I am missing something.

if (lines.length) {
var newRecords = [];
lines.forEach(function(line) {
var record = _.clone(line);
delete record.Id;
if (newRecords.length) {
return conn.sobject('SBQQ__QuoteLine__c').create(newRecords, function(err, ret) {
alert('after new insert -->'+JSON.stringify(ret));
return Promise.resolve();
AbhishekAbhishek (Salesforce Developers) 

You can use the code snippet as mentioned in the above blog.

I have updated the correct link, you have to make some changes based on your requirement.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Emily Johnson 23Emily Johnson 23
Which one? I don't see one specific to cloning a record.