Netsuite API - PHP将自定义字段附加到新客户

问题描述 投票:2回答:1

我遇到了netsuite api的问题。我正在尝试添加具有自定义字段类型的客户。 netsuite文档没有任何帮助。我感谢任何帮助。谢谢。

$customFields = array('internalId' => 'custentity_nso_f_donortype', 
                      'value' => new nsListOrRecordRef(array('internalId' => "1"))
                );
$customObject = new nsComplexObject("SelectCustomFieldRef");
$customObject->setFields($customFields);
$customerFields = array (
        'isPerson'          => true,
        'firstName'         => $firstName,
        'lastName'          => $lastName,
        'companyName'           => $companyName,
        'phone'             => $phone,
        'email'             => $email,
        'customFieldList'   => $customObject,
        'addressbookList'   => array (
                'addressbook'   => array(
                        'addr1'     => $addr1,
                        'city'      => $city,
                        'state'     => $state,
                        'zip'       => $zip
                )
        )
);

// create Customer record
$customer = new nsComplexObject('Customer');
// set fields
$customer->setFields($customerFields);

// perform add operation and store nsWriteResponse object in $addResponse variable
$addResponse = $myNSclient->add($customer);

// handle add response
if (!$addResponse->isSuccess) {

    echo "<font color='red'><b>" . $addResponse->statusDetail[0]->message . "</b></font>";

} else {

    echo "<font color='green'><b>SUCCESS!!!</b></font>";

}
php soap netsuite
1个回答
3
投票

我在我的博客上发布了一个相当深入的代码示例,演示了如何使用add a customer to Netsuite with custom fields in php。它应该至少让你走上正确的道路。

© www.soinside.com 2019 - 2024. All rights reserved.