ANS-0710 · SUITESCRIPT DEVELOPMENT
How to Handle NetSuite Search Results Exceeding 1000 Records in SuiteScript
Learn best practices for efficiently processing large NetSuite search results, including strategies for governance management and data iteration.
Short answer
For NetSuite searches returning over 1000 results, consider rescheduling scripts if processing each line consumes significant governance units. Otherwise, leverage the N/search.runPaged method for efficient iteration. Always ensure search results are sorted by internalid for consistent processing.
Scenario
NetSuite developers creating SuiteScript often encounter situations where search results exceed the default maximum of 1000 records. This scenario requires a robust approach to ensure all relevant data is processed efficiently while adhering to NetSuite's governance limits.
Solution
Evaluate Governance Unit Consumption
If processing each search result line consumes more than 10 governance units, implementing a rescheduling strategy is often the most effective approach to avoid script termination.
Iterate Large Search Results
When governance consumption per line is lower, the
N/search.runPagedmethod is the recommended best practice for iterating through large search results in SuiteScript. This method efficiently handles results exceeding the 1000-record limit.Implement Rescheduling Mechanisms
If needed, governance-aware rescheduling mechanisms can be implemented to manage script execution within NetSuite's limits.
Sort Search Results
Always ensure search results are sorted by
internalidto maintain consistent order and facilitate reliable processing, especially when dealing with large datasets or potential script rescheduling.
Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
