Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sort results when querying the NetSuite API?

Tags:

netsuite

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!

like image 897
Joannes Vermorel Avatar asked Sep 02 '25 07:09

Joannes Vermorel


1 Answers

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)

like image 159
dangig Avatar answered Sep 04 '25 22:09

dangig