N/task Module and SearchTask Object Overview in SuiteScript
Understand the N/task module for creating tasks, including SearchTask properties for asynchronous operations.
TL;DR Opening
The N/task module in SuiteScript allows developers to create various asynchronous tasks such as scheduled scripts, map/reduce jobs, and data imports. Notably, it includes the SearchTask object, which facilitates initiating asynchronous searches within NetSuite.
What is the N/task Module?
The N/task module is a powerful tool that enables you to manage tasks within the internal NetSuite scheduling or task queue. It supports different task types, each designed for specific operations, including:
- Submitting scheduled scripts
- Running map/reduce scripts
- Importing CSV files
- Merging duplicate records
- Executing various types of searches and workflows
Each type of task corresponds to specific object types that provide methods to configure, submit, and monitor tasks efficiently. All tasks triggered by this module operate asynchronously, guaranteeing that execution will not block other processes in NetSuite.
Understanding the SearchTask
The SearchTask object is part of the N/task module and is specifically designed to initiate asynchronous search operations. Below, we explore the properties and methods associated with the SearchTask object.
SearchTask Object Members
The SearchTask object includes relevant properties required to set up and initiate searches. Here’s a brief overview:
| Member Type | Name | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
| Object | task.SearchTask | Object | Server scripts | The properties required to initiate an asynchronous search. |
| Object | task.SearchTaskStatus | Object | Server scripts | The status of an asynchronous search task placed into the queue. |
Key Methods
The main method related to the SearchTask is as follows:
task.create(options): This method is used to create aSearchTaskobject with specified configurations. Theoptionsparameter allows you to define the details of the search.
Key Notes
- Every task triggered with the N/task module is executed asynchronously, making it critical for operations that require immediate processing without delays. This approach ensures the efficiency of the NetSuite environment, especially when dealing with large data sets or complex scripted processes.
Who This Affects
- Developers: Those creating scripts that require asynchronous task processing.
- Administrators: Users managing system performance and script execution in NetSuite.
- Integrators: Professionals integrating with external systems using NetSuite task capabilities.
Key Takeaways
- The N/task module is essential for managing asynchronous tasks within NetSuite.
SearchTaskfacilitates executing asynchronous searches efficiently.- Understanding task properties and methods is crucial for effective script development.
Frequently Asked Questions (4)
Does the N/task module support synchronous task execution?
What script types are supported by the SearchTask object?
What method should be used to create a SearchTask object?
Can the N/task module be used to merge duplicate records?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
