我想从Netsuite检索vendorBills。
这是我的代码
TransactionSearch transactionSearch = new TransactionSearch();
TransactionSearchBasic tranSearchBasic = new TransactionSearchBasic();
TransactionSearchAdvanced tranAdvancedSearch = new TransactionSearchAdvanced();
SearchDateField searchDate = new SearchDateField();
searchDate.setOperator(SearchDateFieldOperator.within);
searchDate.setSearchValue(startDate);
searchDate.setSearchValue2(endDate);
tranSearchBasic.setDateCreated(searchDate);
transactionSearch.setBasic(tranSearchBasic);
tranAdvancedSearch.setCriteria(transactionSearch);
SearchResult billResult = port.search(tranAdvancedSearch);
以上代码重新创建在指定日期之间创建的所有交易记录。 但我想过滤掉vendorBill。
我试过以下
String[] type = new String[1];
type[0]=RecordType._vendorBill;
tranSearchBasic.setType(type);
但它返回null。
webservice主机地址:https://webservices.na1.netsuite.com/wsdl/v2012_2_0/netsuite.wsdl
任何直接的帮助表示赞赏
答案 0 :(得分:2)
$typeSearchField = new SearchStringField();
$typeSearchField->operator = SearchStringFieldOperator::is;
$typeSearchField->searchValue = "SalesOrder";
$search = new TransactionSearchBasic();
$search->recordType = $typeSearchField;
$request = new SearchRequest();
$request->searchRecord = $search;
$searchResponse = $service->search($request);
这就是你在PHP for Sales Orders中这样做的方法。 C#代码应如下所示。
TransactionSearchBasic tranSearchBasic = new TransactionSearchBasic();
SearchDateField searchDate = new SearchDateField();
searchDate.setOperator(SearchDateFieldOperator.within);
searchDate.setSearchValue(startDate);
searchDate.setSearchValue2(endDate);
SearchStringField searchRecordType = new SearchStringField();
searchRecordType.setOperator(SearchStringFieldOperator.is);
searchRecordType.setSearchValue("VendorBill");
tranSearchBasic.setDateCreated(searchDate);
tranSearchBasic.setRecordType(searchRecordType);
SearchResult billResult = port.search(tranSearchBasic);