You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在NetSuite客户upsert操作中指定Primary Subsidiary的值

问题原因

NetSuite开启多子公司功能后,客户主数据的*Primary Subsidiary(主附属公司)*是必填标准字段,你当前的SOAP请求未正确配置该字段导致报错。

解决方法

你需要将subsidiary标准字段添加到<ns2:record>节点下(和entityId、companyName等标准字段平级,不要放入自定义字段列表customFieldList中),字段类型为RecordRef,填写对应子公司的内部ID即可。
示例配置如下:

<ns2:subsidiary internalId="你对应子公司的实际内部ID"/>

你可以登录NetSuite后台,进入「设置 > 公司 > 子公司」路径查看对应子公司的internalId值。

修改后的完整SOAP请求参考

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="urn:messages_2019_1.platform.webservices.netsuite.com" 
    xmlns:ns2="urn:relationships_2019_1.lists.webservices.netsuite.com" 
    xmlns:ns4="urn:relationships.lists.webservices.netsuite.com" 
    xmlns:ns3="urn:core_2019_1.platform.webservices.netsuite.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap-env:Header>
        <tokenPassport>
            <account>%v</account>
            <consumerKey>%v</consumerKey>
            <token>%v</token>
            <nonce>%v</nonce>
            <timestamp>%v</timestamp>
            <signature algorithm="HMAC-SHA256">%v</signature>
        </tokenPassport>
        <preferences>
      </preferences>
    </soap-env:Header>
    <soap-env:Body>
        <ns1:upsert>
            <ns2:record xsi:type="ns2:Customer" externalId="10">
                <ns2:entityId>%v</ns2:entityId>
                <ns2:companyName>%v</ns2:companyName>
                <ns2:email>%v</ns2:email>
                <!-- 新增的主附属公司字段 -->
                <ns2:subsidiary internalId="1"/>
                <ns3:customField xsi:type="ns3:RecordRef" scriptId="custbody_inv_worksheet_currency">
                    <ns3:value internalId="10">
                        <ns3:name>EUR</ns3:name>
                    </ns3:value>
                </ns3:customField>
                <ns2:customFieldList>
                    <ns3:customField xsi:type="ns3:SelectCustomFieldRef" scriptId="custentity_vies_check_customer">
                        <ns3:value internalId="2">
                            <ns3:name>Approved</ns3:name>
                        </ns3:value>
                    </ns3:customField>
                    <ns3:customField xsi:type="ns3:SelectCustomFieldRef" scriptId="custentity_sales_type">
                        <ns3:value internalId="2">
                            <ns3:name>B2B</ns3:name>
                        </ns3:value>
                    </ns3:customField>
                    <ns3:customField xsi:type="ns3:SelectCustomFieldRef" scriptId="custentity_kyc_status">
                        <ns3:value internalId="2">
                            <ns3:name>Approved</ns3:name>
                        </ns3:value>
                    </ns3:customField>
                    <ns3:customField xsi:type="ns3:SelectCustomFieldRef" scriptId="custbody_inv_worksheet_currency">
                        <ns3:value internalId="10">
                            <ns3:name>EUR</ns3:name>
                        </ns3:value>
                    </ns3:customField>
                </ns2:customFieldList>
            </ns2:record>
        </ns1:upsert>
    </soap-env:Body>
</soap-env:Envelope>

额外注意事项

  • 确认你使用的API角色拥有对应子公司的客户操作权限,权限不足也可能触发类似必填项缺失的报错
  • 如果是更新已有的客户数据,确保填写的子公司ID和该客户已绑定的子公司范围兼容,避免出现权限冲突

内容的提问来源于stack exchange,提问作者Dan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 10:45:03