Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
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);