このエラーの取得無効なcustrecord_lt_partner参照キー225399。
最初の2つのフィールドはリスト/レコードで、3番目のフィールドは自由形式のテキストです。
管理者権限を持つ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;
}