ワーク オーダー番号に基づいて NetSuite からワーク オーダー レコードを取得する必要があります。保存済み検索を使用してそれを実行できますが、本番環境で別の保存済み検索レコードを作成する必要がないため、保存済み検索なしで実行したいと考えています。私のコードは結果を返していませんが、検索は成功しています。
ここに私が使用しているコードがあります:
TransactionSearch ts = new TransactionSearch();
TransactionSearchBasic tsb = new TransactionSearchBasic();
// work order number
SearchStringField sfTranId = new SearchStringField();
sfTranId.@operator = SearchStringFieldOperator.@is;
sfTranId.searchValue = workorder;
sfTranId.operatorSpecified = true;
// type
SearchEnumMultiSelectField sfType = new SearchEnumMultiSelectField();
sfType.@operator = SearchEnumMultiSelectFieldOperator.anyOf;
sfType.operatorSpecified = true;
sfType.searchValue = new String[] {"_workOrder"};
tsb.tranId = sfTranId;
tsb.type = sfType;
ts.basic = tsb;
tsa3.criteria = ts;
// perform the search
SearchResult res = _service.search(ts);
res.pageSizeSpecified = true;
if (res.status.isSuccess)
{
SearchRow[] searchRows = res.searchRowList;
if (searchRows != null && searchRows.Length >= 1)
{
TransactionSearchRow tranRow = (TransactionSearchRow)searchRows[0];
if (tranRow.basic.internalId != null && tranRow.basic.internalId.Length > 0)
{
woResult = tranRow.basic.internalId[0].searchValue.internalId;
}
}
}