In this post I’ll show you how to customize the Search API in NetSuite to search for more than 1000 records. As you know, NetSuite provides an in-built search method for retrieving supported records by using the nlapiSearchRecord API. The only limitation of this API is that it can only search through 1000 rows at a time. This can be a problem when you want to search for more than 1000 records, for instance, to perform some calculation.
You can work around this limitation by tweaking the script of (customizing) the Search API, thereby enabling it to search for more than a thousand records. Let’s look at an example.
Understanding the 1000 Record Limitation
By default, when you run a search using SuiteScript, NetSuite returns a maximum of 1000 records in a single result set.
This means:
search.run().each()will only iterate up to 1000 records- Any records beyond that are not returned unless handled explicitly
For small datasets, this is not an issue. But for reporting, integrations, or bulk processing, this becomes a major limitation.
In the code snippet below, I have customized the Search API script to fetch more than a thousand customer records.
var search = nlapiCreateSearch('customer'), searchResults = search.runSearch(), resultIndex = 0, resultStep = 1000, resultSet, resultSets = []; do { resultSet = searchResults.getResults(resultIndex, resultIndex + resultStep); resultSets = resultSets.concat(resultSet); resultIndex = resultIndex + resultStep; } while (resultSet.length > 0);
As you can see, in the above case resultSets will display all the rows if more than 1000 rows exist for this query. In the same way, you can create a generalized search function to search for 1000+ records in NetSuite.
Performance Considerations
When working with large datasets, performance becomes critical.
Keep in mind:
- Avoid processing everything in a single execution if not required
- Use pagination to control memory usage
- Monitor governance limits in SuiteScript
- Consider scheduled scripts for large operations
Efficient design ensures your script runs reliably without hitting limits.
Common Mistakes to Avoid
- Assuming
run().each()returns all records - Fetching unnecessary columns
- Ignoring governance limits
- Not handling pagination properly
These mistakes can lead to incomplete data processing or script failures.
When to Use Advanced Customization
You may need deeper customization when:
- Handling very large datasets (10,000+ records)
- Integrating NetSuite with external systems
- Running batch data processing jobs
In such cases, combining pagination, filtering, and optimized logic is essential.
Final Thoughts
Customizing the NetSuite Search API is essential when working with large datasets. The 1000 record limit is not a blocker if you use the right approach.
Methods like runPaged() and getRange() allow you to scale your searches and process data efficiently. With proper optimization and structure, you can build reliable, high-performance scripts that handle even the largest datasets in NetSuite.
Stuck on a Step?
If your script is not returning all records or stopping at 1000, the issue is usually related to how the search is executed. Review whether you’re using pagination methods like runPaged() or getRange() correctly.
Even small gaps in logic can lead to incomplete results, so testing and validation are important.
NetSuite Alliance Partner
Working with a NetSuite Alliance Partner can help you build optimized SuiteScript solutions for handling large datasets.
An experienced partner can:
- Design efficient search logic for large data volumes
- Optimize scripts for performance and governance limits
- Build scalable integrations and automation
This ensures your NetSuite environment runs smoothly, even with complex data processing needs.