1

I'm trying to find a way to merge two customer records in NetSuite. Our NetSuite data is synced from a SQL Server database, and occasionally two customer accounts are merged there. I need this to be reflected in NetSuite. I see that there is some duplicate detection and merging available in the NetSuite interface. Is it possible to kick off a customer merge via a webservice call? I'm using C# and a custom SuiteTalk app to move the data into NetSuite.

Edit: alternatively, it might work to make the old customer account a subcustomer of the new account. Has anyone done this via webservices?

melicent
  • 1,221
  • 15
  • 22

1 Answers1

0

You cannot run the merge process via SuiteTalk.

There are a couple of ways to achieve your goal. To my mind the simplest thing would be to create a custom field on customer that indicates "merge to master" and then run a schedule script to check for customers with values in that field and run a merge to master process.

So basically:

  1. create a custom field that holds a reference to a the master record
  2. update that field on the to-be-merged duplicate via SuiteTalk
  3. create a scheduled script that checks for that field being populated; when found the script would set up a merge job

You don't have to have duplicate detection turned on in your Netsuite account for this to work. The merge engine is accessible via suitescript. The function below takes the internal id of the master and duplicate record and sets up the merge job:

function queueMerge(masterId, mergeId) {
    try {
        var manager = nlapiGetJobManager('DUPLICATERECORDS');

        var dupeJob = manager.createJobRequest();

        dupeJob.setEntityType(dupeJob.ENTITY_CUSTOMER);
        dupeJob.setMasterSelectionMode(dupeJob.MASTERSELECTIONMODE_SELECT_BY_ID);
        dupeJob.setMasterId(masterId);
        dupeJob.setOperation(dupeJob.OPERATION_MERGE);
        dupeJob.setRecords([masterId, mergeId]);

        var jobId = manager.submit(dupeJob);
        nlapiLogExecution("DEBUG", "setup merge for " + mergeId + " with " + jobId);
    } catch (e) {
        nlapiLogExecution("ERROR", "on merge for " + mergeId, e);
    }
}
bknights
  • 14,408
  • 2
  • 18
  • 31
  • Can you please answer my question: https://stackoverflow.com/questions/58181928/how-to-send-defaulttaxreg-with-add-customer-netsuite-soap-request – ankit Oct 01 '19 at 10:15