Search Load Method for SuiteScript 2.x Development
The search.load method in SuiteScript 2.x allows developers to load existing saved searches efficiently, ensuring seamless integration in scripting tasks.
The search.load method in SuiteScript 2.x is essential for loading existing saved searches into your scripts. This feature allows you to leverage previously created searches—whether they were built using the user interface or programmatically with the search.create(options) and Search.save() methods. By using this method, developers can streamline their scripts and enhance functionality.
Method Overview
- Method:
search.load(options) - Returns: A
search.Searchobject - Supported Script Types: Client and server scripts
- Governance: 5 units
- Module: N/search Module
Parameters
The options parameter is a JavaScript object that contains the following:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
options.id | string | Required | Internal ID or script ID of the saved search. The script ID must start with customsearch. |
options.type | string | Required if applicable | Specifies the search type of the saved search. This is necessary if the saved search uses a standalone search type, which does not correspond to a specific record type. Typical usage involves using predefined enums available in the search.Type enumeration. |
Here are some examples of standalone search types:
- DeletedRecord
- EndToEndTime
- ExpenseAmortPlanAndSchedule
- RevRecPlanAndSchedule
- InventoryBalance
Note: The options.type parameter is required if the saved search uses a standalone search type; otherwise, it is optional.
Error Handling
When using the search.load method, you might encounter the following error codes:
| Error Code | Message | Thrown If |
|---|---|---|
INVALID_SEARCH | That search or mass update does not exist. | The saved search ID in options.id is invalid. |
SSS_MISSING_REQD_ARGUMENT | {1}: Missing a required argument: {2} | A required parameter is missing in the request. |
Example Usage
Below is a basic syntax example demonstrating how to utilize the search.load method:
// Load an existing saved searchvar mySearch = search.load({ id: 'customsearch_my_so_search'});This method ensures efficiency by enabling scripts to access predefined searches without needing to recreate them, thereby streamlining the search process in SuiteScript.
Related Topics
- N/search Module
- SuiteScript 2.x Modules
- SuiteScript 2.x
Source: This article is based on Oracle's official NetSuite documentation.
Key Takeaways
- The
search.loadmethod retrieves existing saved searches for reuse. - Understanding parameters like
options.idandoptions.typeis critical. - Error codes provide valuable feedback during script execution.
Frequently Asked Questions (4)
What parameters are required to use the search.load method in SuiteScript 2.x?
How does the search.load method handle errors in SuiteScript 2.x?
Does the search.load method in SuiteScript 2.x require governance units?
Is the search.type parameter necessary for all saved searches when using search.load?
Was this article helpful?
More in General
- Payment Date Prediction Feature in NetSuite
Payment Date Prediction in NetSuite utilizes machine learning to enhance financial planning by predicting invoice payment dates.
- NetSuite Ship Central Enhancements for Packing & Shipping
NetSuite Ship Central features enhance packing and shipping operations for improved efficiency and accuracy.
- Generative AI Features in NetSuite 2026.1
Discover new generative AI features in NetSuite 2026.1, enhancing reporting, search, predictions, and development productivity.
- Field Service Management Enhancements and Bug Fixes for 2026
Overview of the 2026 Field Service Management SuiteApp updates showcasing enhancements and bug fixes.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category