我是 netSuite 的新手,尝试使用 Web 服务将客户数据传递到自定义字段(业务类型、客户市场、区域),但在 xml 响应中出现错误。
如果有人有想法,请在 php 脚本中提供帮助
以下是脚本和 xml 响应。
脚本:
<?
require_once '../PHPToolkit/NetSuiteService.php';
$service = new NetSuiteService();
$customer = new Customer();
$customer->lastName = "Amit";
$customer->firstName = "Rathi";
$customer->companyName = "xxxxxxx.xxx";
$customer->phone = "123456789";
$customer->email = "xxxx@xxxxxxx.xxx";
$labName = new StringCustomFieldRef();
$labName->internalId = "custevent12"; // internal id of the input in Netsuite
$labName->value = "USA East"; // your input
$labName1 = new StringCustomFieldRef();
$labName1->internalId = "custevent11"; // internal id of the input in Netsuite
$labName1->value = "Dealer"; // your input
$labName2 = new StringCustomFieldRef();
$labName2->internalId = "custevent14"; // internal id of the input in Netsuite
$labName2->value = "Residential"; // your input
$customer->customFieldList= new CustomFieldList();
$customer->customFieldList->customField = array($labName1,$labName2,$labName);
$request = new AddRequest();
$request->record = $customer;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
?>
XML 请求:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:relationships_2013_1.lists.webservices.netsuite.com" xmlns:ns2="urn:core_2013_1.platform.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="urn:messages_2013_1.platform.webservices.netsuite.com" xmlns:ns4="ns"><Header>
<passport xsi:type="Passport"><email>xxxxxx@xxxxx.com</email><password>[Content Removed for Security Reasons]</password><account>xxxxx</account><role internalId="3"/></passport></Header>
<Body><add><record xsi:type="Customer"><firstName>Rathi</firstName><lastName>Amit</lastName><companyName>Live2support.com</companyName><phone>123456789</phone><email>xxx@xxxxxx.com</email><customFieldList><customField internalId="custevent11" xsi:type="StringCustomFieldRef"><value>[Content Removed for Security Reasons]</value></customField><customField internalId="custevent14" xsi:type="StringCustomFieldRef"><value>[Content Removed for Security Reasons]</value></customField><customField internalId="custevent12" xsi:type="StringCustomFieldRef"><value>[Content Removed for Security Reasons]</value></customField></customFieldList></record></add></Body></Envelope>
回复:
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_1.platform.webservices.netsuite.com"><platformMsgs:nsId>WEBSERVICES_3434906_10312013233905655255582218_d18e16e7454b3</platformMsgs:nsId></platformMsgs:documentInfo></soapenv:Header><soapenv:Body><addResponse xmlns="urn:messages_2013_1.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status isSuccess="false" xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com"><platformCore:statusDetail type="ERROR">
<platformCore:code>USER_ERROR</platformCore:code>
<platformCore:message>Please enter value(s) for: Business Type, Customer Market, Regions</platformCore:message>
</platformCore:statusDetail></platformCore:status></writeResponse></addResponse></soapenv:Body></soapenv:Envelope>