使用C#代码在netsuite中搜索bin编号

时间:2012-10-04 15:35:06

标签: c# netsuite

我正在尝试搜索一个bin number =" 1"从给定的位置(仓库)。我的代码就像

        RecordRef[] referLocation = new RecordRef[1] { new RecordRef { } };
        referLocation[0].type = RecordType.location;
        referLocation[0].internalId = "6";

        BinSearch bSearch = new BinSearch();
        BinSearchBasic bSBasic = new BinSearchBasic();
        SearchStringField strField = new SearchStringField ();
        SearchMultiSelectField multiSelect = new SearchMultiSelectField();

        multiSelect.searchValue = referLocation;
        bSBasic.location = multiSelect;
        strField.searchValue = "1";
        bSBasic.binNumber = strField;
        bSearch.basic = bSBasic;

        var response = _service.search(bSearch);
        if (response.status.isSuccess)
            Console.WriteLine(strField.searchValue + "exists");
        else
            Console.WriteLine(strField.searchValue + "Not exists");

但是即使bin号码= 1在te netsuite中,它也会给出Not Notists。任何人都可以帮我指出代码中有什么错误或遗漏?谢谢

2 个答案:

答案 0 :(得分:0)

我发现的一件事是,如果NetSuite中的记录被标记为“非活动”,则不会在任何API搜索中返回,并且任何通过该ID的添加/更新调用都将失败。

答案 1 :(得分:0)

您没有在任何搜索条件中提供运算符,请在基本搜索中传递搜索值之前将这些行添加到您的代码中:

multiSelect.@operator = SearchMultiSelectFieldOperator.anyOf;
multiSelect.operatorSpecified = true;

strField.@operator = SearchStringFieldOperator.@is;
strField.operatorSpecified = true;