This sample code updates the the Ship Address and Sales Order Item on a Sales Order record via PHP Toolkit 2012.2
require_once '../NSPHPClient/NetSuiteService.php';
$service = new NetSuiteService();
$salesOrder = new SalesOrder();
$salesOrder->internalId = 9678;
$salesOrder->shipAddress = "Bill Hicks2 \r 123Main Street \r New York NY10004 \r United States";
$salesOrder->itemList = new SalesOrderItemList();
$salesOrderitem = new SalesOrderItem();
$salesOrderitem->item = new RecordRef();
$salesOrderitem->item->internalId = 86;
$salesOrderitem->quantity = 3;
$salesOrder->itemList->item = array($salesOrderitem);
$updateRequest = new UpdateRequest();
$updateRequest->record = $salesOrder;
$updateResponse = $service->update($updateRequest);
if (!$updateResponse->writeResponse->status->isSuccess) {
echo "UPDATE ERROR";
} else {
echo "UPDATE SUCCESS, id " . $updateResponse->writeResponse->baseRef->internalId;
}
No comments:
Post a Comment