15 September, 2023

NetSuite Save Search Pagination


NetSuite is a cloud-based enterprise resource planning (ERP) software that offers a range of tools and features for managing business operations and data. One of the features of NetSuite is the ability to create saved searches. This allows users to define specific criteria for searching and filtering their data, and then save those criteria for future use. 

Read more: Benefits of NetSuite ERP Platform for Growing Businesses

Pagination is a process of splitting a large number of saved search results into chunks (pages) in order to process them more efficiently, in line with SuiteScript governance limits. To paginate the results of a saved search in NetSuite, users can use the ‘search.create.setPaging’ function. This function takes two arguments: the page index (an integer starting at 0) and the page size (the number of results to return per page). 

This blog highlights how users can run a search in the script and access large data sets without any governance errors. 

When a user runs a search in the script, they use API.

 search.run().getRange({ start : 0, end: 1000});  

to get only 1000 results.

Let’s consider a scenario where a developer is working on an integration and is expecting to retrieve 100’000 + lines of data from NetSuite. In this scenario, our developer must consider Saved Search and platform limitations, including the back-end system data governance. 

First, the user needs to write a script, it may be a user event, client script, map Reduce, RestLet. Now with the help of the search module, the user can create/load the search in their code.

Next, the developer will call ‘Search.run()’ method. They must not forget to add ‘start’ and ‘end’ variables as demonstrated below:

Var startIndex = 0; Var RANGECOUNT = 1000; 

Modify the standard behavior of search.run() with logic as explained below:

this image shows the saved search ID

Streamline Your NetSuite Operations with AlphaBOLD

Efficiency is key in managing your NetSuite environment. Learn how AlphaBOLD can help you implement effective pagination in saved searches, ensuring quicker access and better data management.

Request A Demo

Load a search that we can export according to the situation explained above. Here we declare and initiate two variables startIndex and RANGECOUNT, and initiate. Next run search in the do while looping and using these variables instead of giving an integers value.

In the very next line, CONCATE results and push into another array allResults (array), and in the next line overwrite startIndex with pagedResultCount right now which is 1000 NOW our startIndex variable is 1000 instead of 0.

Now we need the next page results and push them into the same array until pagedResultsCount == RAGECOUNT and loop is running until all save search results are not pushed into allResults (array).

LASTLY, when looking at the logs, you can see all search results are pushed into a single array and you can use it according to your situation. 


With Search Pagination you can run a search without any limitation error and no matter what the range of results, they are automatically handled and pushed into your array.

Transform Your Data Management with AlphaBOLD's NetSuite Services

AlphaBOLD is ready to assist with cutting-edge solutions that simplify data access and enhance your system's performance.

Request A Demo

Explore Recent Blog Posts

Copyright © 2024 AlphaBOLD | NetSuite Solution Provider | All Rights Reserved