I'm having trouble adding a customers address to netsuite. everything is working except for the address. This is the error im getting back:
Warning: Trying to assign an object into an array parameter "addressbook" of class "CustomerAddressbookList", it will be omitted
$service = new NetSuiteService();
$customer = new Customer();
$customerFields = array (
'firstName' => "Joe",
'lastName' => "Doe",
'companyName' => "ABC company5",
'phone' => "123456789",
'email' => "joe.doe@abc.com",
'addressbookList' => array (
'addressbook' => array(
'addr1' => "asdfsadf",
'city' => "asfff",
'state' => "asdf",
'zip' => 2323
)
)
);
setFields($customer, $customerFields);
$request = new AddRequest();
$request->record = $customer;
$addResponse = $service->add($request);
I always try to create records first, then tie them together later. Try something like this (untested, and off the top of my head):
Create addressbook entry.
$customer = new Customer();
...
$address = new CustomerAddressBook();
$address->defaultShipping = false;
$address->defaultBilling = false;
$address->attention = "Attention Name";
$address->addr1 = "Address 1";
$address->city = "City";
$address->zip = "12345";
$address->state = "MA";
$addressBook = new CustomerAddressbookList();
$addressBook->addressbook = array($address);
$addressBook->replaceAll = false;
$customer->addressbookList = $addressBook;
The rest of your code looks OK to me.