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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category