Reputation: 25938
How can I merge 2 records in SuiteScript 1.0?
For example; I want to merge 2 customer records. The reason being we have many customers in our NetSuite backend that have not registered in our website. When they register NetSuite automatically creates a new customer instead of consolidating the existing customer. So I want to merge/consolidate those 2 records.
I have found nlapiMergeRecord(id, baseType, baseId, altType, altId, fields)
but the help documentation says this function is now deprecated...
THIS API HAS BEEN DEPRECATED
This API is deprecated as of NetSuite Version 2015 Release 1. This function will no longer be supported as of Version 2016 Release 1.
Upvotes: 2
Views: 1015
Reputation: 3783
The nlapiMergeRecord
actually does/did something completely different to what you are looking for. It was used for merging a record with a template to create a "mail merge".
For merging duplicate records in SuteScript 1.0 you can use the Job Manager APIs
var manager = nlapiGetJobManager('DUPLICATERECORDS');
var mergeJobRequest = manager.createJobRequest();
mergeJobRequest.setEntityType(mergeJobRequest.ENTITY_LEAD);
mergeJobRequest.setMasterSelectionMode(mergeJobRequest.MASTERSELECTIONMODE_CREATED_
EARLIEST);
mergeJobRequest.setRecords(duplicateRecords);
mergeJobRequest.setOperation(mergeJobRequest.OPERATION_MERGE);
jobId = manager.submit(mergeJobRequest);
Upvotes: 2
Reputation: 8847
I don't know how you do this in SuiteScript 1.0; you can still try the Deprecated API. Deprecated doesn't necessarily mean deactivated.
In SuiteScript 2.0, you can use the N/task
module to kick off an EntityDeduplicationTask
, which gives you similar functionality to the Deduplication actions in the UI.
You can merge, delete, make parent-child, or mark as not duplicates, and you can select which record becomes the master based on certain criteria.
Upvotes: 2