Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
Copy an Existing Customer Record
Hi,
I am trying to use the nlapiCopyRecord function to make a copy of an existing customer record and save it as a child record of that existing customer.
When my newly copied customer object is saved via the nlapiSubmitRecord function I get a duplicate error.
This appears to be due to the internal ID being copied with the other information from the source customer record.
Here is a snippet:
//////////////////////////
currentRecord = nlapiLoadRecord('customer',custIDArray[i]);
//custIDArray[i] is the internalID of a customer record returned in a searchresult.
var newID = currentRecord.getFieldValue('entityid') + 'E';
newRecord = nlapiCopyRecord('customer',currentRecord.getId());
newRecord.setFieldValue('entityid',newID);