尝试通过PHP工具包向netsuite添加销售订单时出现错误
我的代码:
<?php
require_once '../PHPToolkit/NetSuiteService.php';
$service = new NetSuiteService();
$so->itemList = new SalesOrderItemList();
$item = new SalesOrderItem();
$so = new SalesOrder();
$entityRR = new RecordRef();
$entityRR->internalId = 10731;
$entityRR->recordType = "customer";
$so->entity = $entityRR ;
$so->currency->internalId = 1;
$so->itemList = new SalesOrderItemList();
$soi = new SalesOrderItem();
$soi->item = new RecordRef();
$soi->item->internalId = 2551;
$soi->quantity = 1;
$pricelevelRR = new RecordRef();
$pricelevelRR->internalId = -1;
$pricelevelRR->recordType = "priceLevel";
$soi->price = $pricelevelRR;
$soi->rate = 55.3;
$so->itemList->item = $soi;
$so->subsidiary->internalId = 5;
$so->location->internalId = 9;
$shipAddress = "123 the street Hampton NY 11937 United States";
$billAddress = "123 The street Hampton NY 11937 United States";
$so->shippingAddress1 = $shipAddress;
$so->billingAddress = $billAddress;
$arr = get_defined_vars();
print_r($arr["so"]);
$request = new AddRequest();
$request->record = $so;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
exit();
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
?>
我得到了这个
的添加回复<platformCore:code>USER_ERROR</platformCore:code>
<platformCore:message>Could not calculate cost for the selected Realtime rate. Missing/Illegal
ShipTo/Address/StateProvinceCode</platformCore:message>
</platformCore:statusDetail></platformCore:status></writeResponse>
</addResponse></soapenv:Body></soapenv:Envelope>
我不太清楚为什么它无法计算成本并且还说发货地址丢失
答案 0 :(得分:0)
我注意到您输入的送货地址是一整个文字。您是否尝试按地址字段输入。 NetSuite具有地址的每个部分的字段:address1,address2,city,state和zip code。
可能正在查看那些字段,这就是它返回错误的原因。