How to sort results when querying the NetSuite API?

1.4k views Asked by At

Through the NetSuite SuiteTalk, I am trying to retrieve the SalesOrder sorted against the lastModified field. I understand how to search with a where constraint (see below) but I can't figure out how to order the results.

    var searchInit = new Func<SearchResult>(() => 
         _client.search(new TransactionSearchBasic
    {
        type = new SearchEnumMultiSelectField
        {
            searchValue = new[] {"_salesOrder"},
            @operator = SearchEnumMultiSelectFieldOperator.anyOf,
            operatorSpecified = true,
        },
        lastModifiedDate = new SearchDateField
        {
            searchValue = sinceLastModified,
            searchValueSpecified = true,
            @operator = SearchDateFieldOperator.after,
            operatorSpecified = true,
        }
    }));

Any insights? Thanks!

1

There are 1 answers

0
dangig On BEST ANSWER

If I recall correctly, it's not possible to sort through SuiteTalk.
Three possible workarounds:
1) Sort the results in your application,
2) Create a saved search in NetSuite which will have the sorting configured properly and then call it using SuiteTalk
3) Use a RESTlet and then in SuiteScript it's easy to have results sorted.(recommended)