0

我已经下载了 2012_2 PHP Toolkit for Netsuite。如果文档很少或没有文档,如果有人可以让我先了解如何连接到在 Netsuite 中创建的自定义记录列表,那就太好了

该列表是netsuite中列表->支持下的实验室。

通过 PHP,我想将数据输入到该列表中,我不需要整个代码,我只需要先了解如何连接到我在 netsuite 中创建的自定义记录。我有自定义记录的内部 id 和 netsuite 中自定义记录的名称。

4

2 回答 2

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();
}
于 2012-11-13T18:58:02.083 回答
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 示例代码。如果您有时间,可以查看这些代码以供将来参考。

问候!

于 2013-04-07T18:58:17.647 回答