Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Netsuite中创建具有默认帐单/发货地址的新客户?_Php_Api_Netsuite - Fatal编程技术网

Php 如何在Netsuite中创建具有默认帐单/发货地址的新客户?

Php 如何在Netsuite中创建具有默认帐单/发货地址的新客户?,php,api,netsuite,Php,Api,Netsuite,我正在尝试使用Netsuite的PHPtoolkip_v2010.php添加新的客户记录,并定义他们的默认发货和账单地址。但是我在浏览文档时遇到了麻烦 以下是我现在创建客户的方式: $customer_data = array( 'firstName'=>$billing_address['first_name'], 'lastName'=>$billing_address['last_name'], 'email'=>$email, 'phon

我正在尝试使用Netsuite的PHPtoolkip_v2010.php添加新的客户记录,并定义他们的默认发货和账单地址。但是我在浏览文档时遇到了麻烦

以下是我现在创建客户的方式:

$customer_data = array(
    'firstName'=>$billing_address['first_name'],
    'lastName'=>$billing_address['last_name'],
    'email'=>$email,
    'phone'=>$phone,
    'isPerson'=>true
);
if(!empty($billing_address['company'])) $customer_data['companyName'] = $billing_address['company'];

$customer = new nsComplexObject('Customer', $customer_data);
$new_customer = $ns->add($customer);
if($new_customer->isSuccess) {
    $customer_id = $new_customer->recordRef->nsComplexObject_fields['internalId'];
}
成功创建客户记录并返回客户的内部ID


架构浏览器列出类型为
listRel:CustomerAddressbookList
的字段
addressbookList
。我假设我需要创建一个列表,将地址添加到列表中,然后将列表附加到客户记录中。但是我不确定该怎么做。

我没有太多地使用2010年的更新,但我已经在我的博客上发布了该工具包以前版本的示例代码。我想他们应该还能工作。

值得注意的是,如果您有多个地址而不是一个地址,那么结构将发生变化。我链接到的示例适用于多个地址

希望这有帮助