简体   繁体   English

NetSuite - SuiteTalk - 合并客户

[英]NetSuite - SuiteTalk - merge customers

I'm trying to find a way to merge two customer records in NetSuite. 我正试图找到一种方法来合并NetSuite中的两个客户记录。 Our NetSuite data is synced from a SQL Server database, and occasionally two customer accounts are merged there. 我们的NetSuite数据从SQL Server数据库同步,偶尔会有两个客户帐户合并。 I need this to be reflected in NetSuite. 我需要将它反映在NetSuite中。 I see that there is some duplicate detection and merging available in the NetSuite interface. 我看到NetSuite界面中有一些重复的检测和合并。 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. 我正在使用C#和自定义SuiteTalk应用程序将数据移动到NetSuite中。

Edit: alternatively, it might work to make the old customer account a subcustomer of the new account. 编辑:或者,它可能会使旧客户帐户成为新帐户的子客户。 Has anyone done this via webservices? 有没有人通过webservices完成这个?

You cannot run the merge process via SuiteTalk. 您无法通过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 通过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. 您无需在Netsuite帐户中启用重复检测即可生效。 The merge engine is accessible via suitescript. 合并引擎可通过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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM