Examples

SuiteScript Search Query

Running a Search Query

SuiteScript search query uses N/search for data retrieval.

SuiteScript Search provides a powerful way to query data within NetSuite using SuiteScript 2.0. The N/search module is the cornerstone for building these queries, allowing developers to retrieve records efficiently from the NetSuite database. This module supports various search types such as saved searches, filters, and columns.

Basic Search Example

To begin with a basic search using SuiteScript, you need to load the N/search module. This example demonstrates how to perform a simple search to retrieve customer records.

Advanced Search: Using Joins

SuiteScript also allows for more advanced queries using joins. In this example, we'll demonstrate how to retrieve sales orders along with customer details. This is done by leveraging the join functionality in the search column.

Using Saved Searches

Saved searches are pre-defined queries in NetSuite that can be executed using SuiteScript. This allows for consistency and reusability across scripts. Here's how you can load and execute a saved search:

Conclusion

SuiteScript search queries using the N/search module are powerful tools for data retrieval in NetSuite. Whether you need to perform simple searches, advanced queries with joins, or execute saved searches, understanding how to leverage these capabilities can significantly enhance your scripting within the platform. These examples serve as a foundation for creating more complex and optimized searches tailored to specific business needs.