MapReduceScriptTask Members and Usage in SuiteScript
MapReduceScriptTask object members enable asynchronous task management in NetSuite SuiteScript for efficient data processing.
The MapReduceScriptTask object members are essential for developers utilizing SuiteScript to manage and execute tasks asynchronously within NetSuite's environment. With these members, tasks such as running map/reduce scripts can be efficiently submitted and monitored.
What is the MapReduceScriptTask?
The MapReduceScriptTask is designed to facilitate the submission of map/reduce scripts, allowing administrators and developers to harness the powerful processing capabilities of NetSuite. This object is part of the N/task module, which handles various task types that can be scheduled and processed asynchronously.
Key Tasks You Can Perform
Using the N/task module, you can manage several types of tasks, including but not limited to:
- Submitting scheduled scripts
- Executing map/reduce scripts
- Importing CSV files
- Merging duplicate records
- Running asynchronous searches and workflows
Task Submission
To submit a map/reduce script deployment, you would typically use the submit() method available in the MapReduceScriptTask object:
var task = task.create({ taskType: task.TaskType.MapReduceScriptTask });var taskId = task.submit();This method sends the task for processing, returning a unique task ID which can be used for monitoring its status.
Properties of MapReduceScriptTask
Here are the main properties of the MapReduceScriptTask object:
| Member Name | Return Type | Description |
|---|---|---|
deploymentId | string | Script ID for the script deployment record for the map/reduce script. |
id | string | The unique ID of the task. |
params | Object | Key-value pairs that override static script parameter field values on the script deployment record. |
scriptId | number | string |
Monitoring Task Status
The status of a submitted map/reduce task can be tracked using its corresponding MapReduceScriptTaskStatus object. You can utilize various methods to retrieve details about the task, as shown below:
var status = task.MapReduceScriptTaskStatus.getCurrentTotalSize();This returns the total size of all work in progress, helping you monitor processing efficiency.
Conclusion
By utilizing the MapReduceScriptTask along with its methods and properties, developers can efficiently manage asynchronous data processing within NetSuite, enhancing operational workflows and data handling processes.
Who This Affects
- Developers: Those creating scripts and automating processes in NetSuite.
- Administrators: Users responsible for task management and script deployments.
Key Takeaways:
- The
MapReduceScriptTaskobject simplifies asynchronous task management in NetSuite. - Use the
submit()method to initiate map/reduce tasks effectively. - Monitor task status using the
MapReduceScriptTaskStatusobject to ensure processing efficiency.
Frequently Asked Questions (4)
Does the MapReduceScriptTask apply to both WMS and standard NetSuite environments?
What permissions are required to use MapReduceScriptTask in SuiteScript?
How can I monitor the status of a map/reduce task during execution?
Can I use parameters to override static script values when submitting a map/reduce script?
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.
