简体   繁体   中英

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

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!

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));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM