ANS-1727 · SUITESCRIPT DEVELOPMENT

How Do NetSuite SuiteScript 1.0 Search APIs Differ: nlapiLoadSearch vs nlapiSearchRecord?

Understanding the distinctions between NetSuite's SuiteScript 1.0 search APIs is crucial for efficient data retrieval and script performance.

Short answer

NetSuite's nlapiSearchRecord is limited to 1000 results. For larger datasets, nlapiCreateSearch and nlapiLoadSearch are required. While nlapiLoadSearch uses existing UI saved searches, nlapiCreateSearch builds ad-hoc searches, and both consume 5 governance units.

Scenario

Developers working with NetSuite SuiteScript 1.0 often need to retrieve data using various search APIs. Understanding the specific limitations and behaviors of nlapiSearchRecord, nlapiCreateSearch, and nlapiLoadSearch is essential for selecting the most appropriate method for data retrieval and optimizing script performance.

Solution

When comparing NetSuite's SuiteScript 1.0 search APIs, key differences impact their usage and performance:

  1. Result Limits:

    nlapiSearchRecord is limited to retrieving a maximum of 1000 rows.nlapiCreateSearch and nlapiLoadSearch allow for the retrieval of more than 1000 results.

  2. Search Definition:

    nlapiLoadSearch requires that the saved search already exists and is configured within the NetSuite UI.nlapiCreateSearch allows for the creation and execution of an ad-hoc search directly within the script, defining filters and columns programmatically.

  3. Governance Units:

    Both nlapiCreateSearch and nlapiLoadSearch consume 5 governance units.

  4. Performance Considerations:

    While older recommendations sometimes suggested converting script-based searches to UI saved searches for potential performance benefits, current best practices for optimal performance and scalability emphasize optimizing search design (filters, columns) and utilizing SuiteScript 2.x search modules.SuiteScript 2.x is the recommended approach for modern NetSuite development, offering improved performance characteristics and scalability over SuiteScript 1.0 APIs.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant