无法使用Netsuite PHP工具包2022_2创建自定义记录

hvvq6cgz  于 2023-01-29  发布在  PHP
关注(0)|答案(1)|浏览(102)

我正在尝试使用NetSuite PHP工具包2022_2创建自定义记录。
在那张唱片上
1.列表/记录字段-物料
1.列表/记录字段-供应商
1.自由格式-文本字段-特别说明
无论我做什么,我不能设置这个自定义记录的字段值。在另一边记录总是创建空字段,即使我在我的代码中设置值...我试图使用文档代码和解决方案,从谷歌,但不幸的是,我不能解决这个问题的小时。任何帮助,不胜感激。谢谢!
例一:

$service = new NetSuiteService();
$customRecord = new CustomRecord(); 
$customRecord->recType = new RecordRef(); 
$customRecord->recType->internalId = "244";
$customRecord->fields = new CustomFieldList();

$itemField = new StringCustomFieldRef(); 
$itemField->value = "2167"; 
$itemField->internalId = "custrecord_item"; 
$customRecord->fields->customField[] = $itemField;

$supplierField = new StringCustomFieldRef(); 
$supplierField->value = "1221"; $supplierField->internalId = "custrecord_supplier"; 
$customRecord->fields->customField[] = $supplierField;

$addRequest = new AddRequest(); 
$addRequest->record = $customRecord;
$addResponse = $service->add($addRequest);

示例2(也不设置字段值):

// Create a object for lab name in netsuite
$itemField = new SelectCustomFieldRef(); 
$itemField->value = new ListOrRecordRef(); 
$itemField->value->internalId = '2167'; // your input 
$itemField->internalId = "custrecord_item"; // internal id of the input in Netsuite

$labCustomRecord = new CustomRecord(); 
$labCustomRecord->recType = new RecordRef(); 
$labCustomRecord->recType->internalId = "244"; // internal id 
$labCustomRecord->customFieldList = new CustomFieldList(); 
$labCustomRecord->customFieldList->customField  = $itemField;

$addRequest = new AddRequest(); $addRequest->record = $labCustomRecord;
$addResponse = $service->add($addRequest);
2q5ifsrm

2q5ifsrm1#

我刚发现了问题。
问题是因为他们的文档对于PHP ToolKit来说是绝对的。我们应该使用scriptId而不是internalId,如下例所示:

$itemField = new StringCustomFieldRef(); 
$itemField->value = "2167"; 
$itemField->scriptId = "custrecord_item"; // DONT USE ->internalId
$customRecord->fields->customField[] = $itemField;

相关问题