ANS-1202 · WEB SERVICES & INTEGRATIONS

How to Ensure Correct Sorting of NetSuite Web Service Search Results?

Leverage NetSuite saved searches to control the order of records returned via web services integrations.

Short answer

To sort NetSuite web service search results, utilize a saved search with predefined sorting criteria. Calling `searchMoreWithId` with this saved search ensures results are returned in the specified order. Note that default web service call orders exist but cannot be modified, varying by record type.

Scenario

Users integrating with NetSuite via web services often need to retrieve search results in a specific order. When performing web service calls, the default ordering of returned records may not align with the required business logic, leading to a need for custom sorting.

Solution

To ensure search results are returned in a desired order when using NetSuite web services, the most effective approach is to employ a saved search configured with specific sorting criteria.

  1. Create or modify a saved search within NetSuite and define the necessary sorting preferences directly on the saved search itself.

  2. When making a web service call, invoke this saved search using the searchMoreWithId function. The results retrieved through this method will reflect the sorting criteria established in the saved search.It is important to note that NetSuite web services have a default order for search results that varies by record type. This default ordering cannot be altered directly through web service calls.

Expert NetSuite Support

Need help with this NetSuite issue?

Web Services & Integrations consulting and configuration support

Talk to a consultant