尝试通过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;
}
?>
我得到了这个的add响应
<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>
我不太清楚为什么它不能计算成本,还说送货地址不见了
2条答案
按热度按时间lx0bsm1f1#
我注意到您输入的送货地址是一个完整的文本。您是否尝试过按地址字段输入它。NetSuite有地址的每个部分的字段:地址1、地址2、城市、州和邮政编码。
它可能正在查找这些字段,这就是它返回错误的原因。
vzgqcmou2#
这是一个老问题,但对于那些正在搜索的人来说,这是一个定价组的问题,要添加自定义金额,您需要将其与NetSuite中的定价组匹配。