Netsuite,如何搜索未结供应商账单(交易)

huangapple go评论57阅读模式
英文:

Netsuite, how to search for Open Vendor Bills (Transactions)

问题

似乎很简单,但在许多情况下,对于NetSuite来说却很痛苦。到目前为止,这是我的代码:

        TransactionSearch invoiceSearch = new TransactionSearch();        
       	            
        TransactionSearchBasic invoiceSearchBasic = new TransactionSearchBasic();

        SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();                       

        criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
        String[] statuses = new String[] { TransactionStatus.BILL_OPEN.toString() };
        
        stats.getSearchValue().addAll(Arrays.asList(statuses));
        
		invoiceSearchBasic.setStatus(stats);

如果我注释掉 invoiceSearchBasic.setStatus 这一行,我可以正常获取所有的交易记录(包括我想要具有 "Open" 状态的交易),但是当该行存在时,我什么都获取不到。不用说,将 TransactionStatus.BILL_OPEN.toString() 更改为 "Open" 也不起作用,那样就太简单了!

英文:

Would seem to be simple but as so often with netsuite, it's painful. This is what i have so far:

        TransactionSearch invoiceSearch = new TransactionSearch();        
       	            
        TransactionSearchBasic invoiceSearchBasic = new TransactionSearchBasic();

        SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();                       
               
        criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
        String[] statuses = new String[] { TransactionStatus.BILL_OPEN.toString() };
        
        stats.getSearchValue().addAll(Arrays.asList(statuses));
        
		invoiceSearchBasic.setStatus(stats);

If i comment out the invoiceSearchBasic.setStatus line I get all the transactions fine (including the ones i want with a staus of "Open") but when it's there I get nothing. Needless to say changing TransactionStatus.BILL_OPEN.toString() to "Open" doesn't work either, that would be far too easy!

答案1

得分: 0

好的,以下是翻译好的内容:

我已经解决了。对于其他人来说,这是问题所在:

从TransactionStatus枚举:

@XmlEnumValue("_billOpen")
BILL_OPEN("_billOpen")

当您记录toString值时,它会给出 BILL_OPEN(而不是 _billOpen

但是我们需要的是 _billOpen

解决方法:

SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();
criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
String[] statuses = new String[] { "_billOpen" };
criteria.getSearchValue().addAll(Arrays.asList(statuses));
英文:

Ok I've resolved it. For anyone else, this is the problem:

from the TransactionStatus enumeration:

@XmlEnumValue("_billOpen")
BILL_OPEN("_billOpen")

which when you log the toString value it gives BILL_OPEN (not _billOpen)

but it's _billOpen we need!

solution:

SearchEnumMultiSelectField criteria = new SearchEnumMultiSelectField();
criteria.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
String[] statuses = new String[] { "_billOpen" };
criteria.getSearchValue().addAll(Arrays.asList(statuses));

huangapple
  • 本文由 发表于 2020年5月5日 17:31:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/61609945.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定