Я хочу получить массив SalesOrders на основе внутренних идентификаторов Netsuite.
Вот с чем я работаю:
<?php
// Collect record references to sales orders by internal ID.
$salesOrderIds = [ 1, 2, 3, 4 ];
$salesOrders = [];
foreach ($salesOrderIds as $id) {
$ref = new RecordRef();
$ref->internalId = $id;
$ref->type = RecordType::salesOrder;
$salesOrders[] = $ref;
}
// Prepare Sales Orders as field for basic search.
$field = new SearchMultiSelectField();
$field->operator = SearchMultiSelectFieldOperator::anyOf;
$field->searchValue = $salesOrders; // I have also tried a RecordRefList here as well with no luck.
// Declare search to search sales order transactions with the internal id multiselect field above.
$basic = new TransactionSearchBasic();
$basic->type = RecordType::salesOrder;
$basic->internalId = $field; // Expected type is correct: SearchMultiSelectField
// Set the search record within the search request.
$search = new SearchRequest();
$search->searchRecord = $basic;
// This is based on application code and is working as expected.
// As far as i'm concerned, this is out of scope of the question (to my knowledge).
$response = $this->basicSearch->queryNetsuite($search, RecordType::salesOrder);
Ответ, который я получаю с string
или integer
значения для $ref->internalId
:
class NetSuite\Classes\Status#480 (2) {
public $statusDetail =>
array(1) {
[0] =>
class NetSuite\Classes\StatusDetail#557 (4) {
public $code =>
string(20) "INVALID_SEARCH_VALUE"
public $message =>
string(35) "You need to provide a search value."
public $afterSubmitFailed =>
NULL
public $type =>
string(5) "ERROR"
}
}
public $isSuccess =>
bool(false)
}
И когда я смотрю на класс SearchMultiSelectField
, чтобы увидеть, что такое searchValue
, это именно то, что я предоставляю; RecordRef[]
class SearchMultiSelectField {
public $searchValue;
public $operator;
static $paramtypesmap = array(
"searchValue" => "RecordRef[]",
"operator" => "SearchMultiSelectFieldOperator",
);
}
Как получить список или Заказы на продажу с помощью набора инструментов Netsuites PHP при передаче массива внутренних идентификаторов?