You need to sign in to do that
Don't have an account?
Emily 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();
}
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();
}
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.