1

我必须根据工作订单号从 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;
                }                    
            }                
        }
4

1 回答 1

0

我意识到我的错误,基本搜索返回 RecordList 而不是 SearchRowList。

于 2013-09-11T07:56:15.747 回答