Я хочу получить все SalesItemTax, но не получаю успешного ответа.
require 'samples/config.php';
use NetSuite\Classes\SearchColumnStringField;
use NetSuite\Classes\CustomerSearchBasic;
use NetSuite\Classes\SalesTaxItemSearchRowBasic;
use NetSuite\Classes\SearchRequest;
use NetSuite\Classes\SearchMoreWithIdRequest;
$service->setSearchPreferences(false, 10);
$emailSearchField = new SearchStringField();
$emailSearchField->operator = "startsWith";
$emailSearchField->searchValue = "";
$search = new SalesTaxItemSearchBasic();
$search->description = $emailSearchField;
$request = new SearchRequest();
$request->searchRecord = $search;
$searchResponse = $service->search($request);
ошибка: SearchRecord is an abstract type and cannot be instantiated
Я также пытался получить его другим методом, но не сработал.
use NetSuite\Classes\getSelectValue;
use NetSuite\Classes\RecordType;
use NetSuite\Classes\getSelectValueRequest;
use NetSuite\Classes\GetSelectValueFieldDescription;
$svr = new getSelectValueRequest();
$svr->fieldDescription = new GetSelectValueFieldDescription();
$svr->pageIndex = 1;
$priceFields = array(
'recordType' => RecordType::cashSale,
'sublist' => 'itemList',
'field' => 'taxCode',
'filterByValueList' => array(
'filterBy' => array(
array(
'field' => 'item',
'sublist' => 'itemList',
'internalId' => '3748',
)
)
)
);
setFields($svr->fieldDescription, $priceFields);
$gsv = $service->getSelectValue($svr);
echo "<pre>";
print_r((array)$gsv);
ошибка: Results are incomplete. You must provide a value for the field subsidiary.
use NetSuite\Classes\SearchRequest;
use NetSuite\Classes\SalesTaxItemSearch;
use NetSuite\Classes\SalesTaxItemSearchBasic;
use NetSuite\Classes\SearchMultiSelectField;
use NetSuite\Classes\SearchEnumMultiSelectField;
use NetSuite\Classes\TaxTypeSearchBasic;
use NetSuite\Classes\setSearchPreferences;
use NetSuite\Classes\RecordRef;
//contains some login credential info
$service->setSearchPreferences(false, 20);
$search = new SalesTaxItemSearch();
//$salesItem = new SalesTaxItemSearchBasic();
//We are searching sales Order record
$SearchEnumMultiSelectField = new SearchEnumMultiSelectField();
$SearchEnumMultiSelectField->searchValue='_unitedStates';
$SearchEnumMultiSelectField->operator='anyOf';
$TaxTypeSearchBasic = new TaxTypeSearchBasic();
$TaxTypeSearchBasic->country = $SearchEnumMultiSelectField;
$search->taxTypeJoin = $TaxTypeSearchBasic;
$request = new SearchRequest();
$request->searchRecord = $search;
//print_r($searchRecord);
$searchResponse = $service->search($request);
print_r($searchResponse);
if (!$searchResponse->searchResult->status->isSuccess) {
var_dump($searchResponse->searchResult->status->statusDetail);
echo "SEARCH ERROR\n";
} else {
$result = $searchResponse->searchResult;
$count = $result->totalRecords;
$records = $result->recordList;
foreach($records->record as $record){
var_dump($record->tranId);
}
echo "\n";
echo $count . " records were found.\n";
}
Ошибка: SearchRecord is an abstract type and cannot be instantiated
Это метод, который я получил через документ https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_2/schema/search/salestaxitemsearch.html?mode=package
Пожалуйста, дайте мне знать правильный способ получения налоговых кодов учетной записи NetSuite.