收到此錯誤無效custrecord_lt_partner參考關鍵詞225399.雖然試圖插入NetSuite的錯誤INVALID_KEY_OR_REF
前兩個字段列表/記錄&第三個字段是自由格式文本。
NetSuite的具有管理員權限
下面是代碼
global $nsClient;
$recordTypeRef = array("internalId" => 91);
$partnerName = "225399";
$companyName = "20562";
$labAcctNum = "7182794";
$partnerNameFields = new nsComplexObject('SelectCustomFieldRef');
$partnerNameFields->setFields(
array(
'value' => new nsListOrRecordRef(array('internalId' => $partnerName)),
'internalId' => 'custrecord_lt_partner'
)
);
$companyNameFields = new nsComplexObject('SelectCustomFieldRef');
$companyNameFields->setFields(
array(
'value' => new nsListOrRecordRef(array('internalId' => $companyName)),
'internalId' => 'custrecord_lt_company'
)
);
$labAcctNumFields = new nsComplexObject('StringCustomFieldRef');
$labAcctNumFields->setFields(
array(
'internalId' => 'custrecord_lt_user_lab_acct_number',
'value' => $labAcctNum,
)
);
$customRecordFields = array(
"recType" => $recordTypeRef,
"customFieldList" => array($partnerNameFields, $companyNameFields, $labAcctNumFields),
);
$customRecord = new nsComplexObject('CustomRecord');
$customRecord->setFields($customRecordFields);
//echo "<pre>"; print_r($customRecord); echo "</pre>"; exit;
$addResponse = $nsClient->add($customRecord);
if($addResponse->isSuccess) {
echo "<pre>"; print_r("Success"); echo "</pre>"; exit;
}
else {
echo "<pre>"; print_r($addResponse->statusDetail[0]->message); echo "</pre>"; exit;
}
謝謝,但我使用舊的庫,現在我使用新的PHP工具包,並得到了一切工作。但要回答你的問題是的,我引用了錯誤的內部ID –