ANS-0315 · SUITESCRIPT DEVELOPMENT

How to Reliably Specify a UI Search with nlapiSearchRecord in NetSuite

When programmatically referencing saved searches in NetSuite scripts, developers should prioritize using the internal ID for consistent execution.

Short answer

To ensure consistent and reliable execution when using nlapiSearchRecord to call a UI saved search in NetSuite, always specify the search by its internal ID. While NetSuite officially supports both internal IDs and script IDs (e.g., 'customsearch123'), the script ID method can be inconsistent, making the internal ID the recommended approach for stability.

Scenario

Developers utilizing nlapiSearchRecord to programmatically access saved searches in NetSuite may encounter inconsistencies when attempting to specify a UI search by its script ID (e.g., 'customsearch123'). Although NetSuite documentation indicates support for both internal IDs and script IDs, using the script ID does not always yield reliable results.

Solution

To ensure consistent and reliable execution when calling a UI search with nlapiSearchRecord, it is recommended to always use the search's internal ID. While nlapiSearchRecord officially supports specifying a UI search using either its internal ID (ex: 123) or its script ID (ex: 'customsearch123'), experience shows that calling by script ID does not always function as expected. Therefore, for robust script development, always retrieve and utilize the internal ID of the UI search.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant