2012-06-05 38 views
2

我遇到了netsuite api的麻煩。我正在嘗試添加一個具有自定義字段類型的客戶。 netsuite文檔沒有幫助。我感謝任何幫助,我可以得到。謝謝。Netsuite API - PHP將自定義字段附加到新客戶

$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>"; 

} 

回答

相關問題