ANS-0992 · SUITESCRIPT DEVELOPMENT

Why Do SuiteScript 2.0 Paged Searches Show Inconsistent Results?

To ensure accurate and complete data retrieval from large UI saved searches via SuiteScript 2.0 paged searches, explicit sorting must always be defined.

Short answer

To prevent inconsistent results, such as duplicate or missing records, when using SuiteScript 2.0's searchModule.load and runPaged on large UI saved searches, always ensure the search has explicit sorting. This is crucial for multi-line transactions. Sorting by Internal ID and Line ID is a recommended practice.

Scenario

When executing large UI saved searches using SuiteScript 2.0's searchModule.load and runPaged methods without defining explicit sorting, inconsistent behavior may occur. While the total number of rows returned by the search might be correct, individual records can appear on multiple pages or be entirely missing from the results. This issue is particularly prevalent when querying multi-line records, such as transactions or Revenue Recognition Plan lines, where multiple lines share the same internal ID.

Solution

To ensure consistent and accurate data retrieval from paged SuiteScript 2.0 searches, it is imperative to always define explicit sorting criteria for the underlying saved search. For UI saved searches, ensure that sorting is configured directly within the search definition. In scenarios involving multi-line records, such as transaction lines, sorting by fields like Internal Id and Line Id is highly recommended to guarantee unique and ordered results across all pages.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant