function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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;
newRecords.push({
record
});
});
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) 
https://developer.salesforce.com/forums/?id=906F0000000BavlIAC

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.

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