Below is a sample script on how to add multiple customer record using addList operation.
<?php
require_once '../NSPHPClient/NetSuiteService.php';
$service = new NetSuiteService();
$customer[0] = new Customer();
$customer[0]->lastName = "Doe5";
$customer[0]->firstName = "John5";
$customer[0]->companyName = "ABC company X5 ";
$customer[0]->phone = "123456222";
$customer[1] = new Customer();
$customer[1]->lastName = "Doe6";
$customer[1]->firstName = "John6";
$customer[1]->companyName = "ABC company X6 ";
$customer[1]->phone = "123456333";
$addListRequest = new AddListRequest();
$addListRequest->record = $customer;
$addListResponse = $service->addList($addListRequest);
for($i=0; $i<count($addListResponse->writeResponseList->writeResponse); $i++)
{
if (!$addListResponse->writeResponseList->writeResponse[$i]->status->isSuccess) {
echo "ADD LIST ERROR";
} else {
echo "ADD LIST SUCCESS ID" . $addListResponse->writeResponseList->writeResponse[$i]->baseRef->internalId."\n";
}
}
?>
No comments:
Post a Comment