我已经为Netsuite下载了2012_2 PHP Toolkit。如果有人能够开始如何连接到Netsuite中创建的自定义记录列表,那么如果有更少或没有文档,那将会很棒。
列表是netsuite中list->支持下的实验。
通过PHP我想输入数据到该列表我不需要整个代码,我只需要一个关于如何连接到我在netsuite中创建的自定义记录的headstart。我有自定义记录的内部ID和netsuite中自定义记录的名称。
答案 0 :(得分:0)
其他人稍后可以参考,这可能会有所帮助
$service = new NetSuiteService();
// Create a object for lab name in netsuite
$labName = new SelectCustomFieldRef();
$labName->value = new ListOrRecordRef();
$labName->value->internalId = $lab_number; // your input
$labName->internalId = "xxxxxx"; // internal id of the input in Netsuite
$labCustomRecord = new CustomRecord();
$labCustomRecord->recType = new RecordRef();
$labCustomRecord->customForm = "xxxx"; // form id
$labCustomRecord->recType->internalId = "xx"; // internal id
$labCustomRecord->customFieldList = new CustomFieldList();
$labCustomRecord->customFieldList->customField = $labName
$addRequest = new AddRequest();
$addRequest->record = $labCustomRecord;
if(!$addResponse[$i]->writeResponse->status->isSuccess) {
echo "<pre>"; print_r("Error"); echo "</pre>"; exit();
} else {
echo "<pre>"; print_r("Success"); echo "</pre>"; exit();
}
答案 1 :(得分:0)
以下是有关如何使用PHP Toolkit 2012.2为自定义记录类型添加新记录的示例代码
//create an instance of the fields of the custom record
$customFieldList = new StringCustomFieldRef();
$customFieldList->internalId = "custrecord_name";
$customFieldList->value = "Test from PHP toolkit";
$basicCustomRecord = new CustomRecord();
$basicCustomRecord->name = "PHP Toolkit 2012.2";
$basicCustomRecord->recType = new RecordRef();
$basicCustomRecord->recType->internalId = "14"; //Record Type's internal ID (Setup > Customization > Record Types > Basic Record Type (Internal ID=14)
$basicCustomRecord->customFieldList = new CustomFieldList();
$basicCustomRecord->customFieldList->customField = $customFieldList;
$addRequest = new AddRequest();
$addRequest->record = $basicCustomRecord;
$addResponse = $service->add($addRequest);
if (!$addResponse->writeResponse->status->isSuccess) { echo "ADD ERROR"; exit();}
else { echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;}
?>
SuiteAnswers中提供了相同的代码。 SuiteAnswers中的PHP Toolkit 2012.2还有许多其他示例代码。如果您有时间,可以查看这些代码以供将来参考。
问候!