MapReduceScriptTask Members and Usage in SuiteScript

MapReduceScriptTask object members enable asynchronous task management in NetSuite SuiteScript for efficient data processing.

·2 min read·View Oracle Docs

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:

javascript
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 NameReturn TypeDescription
deploymentIdstringScript ID for the script deployment record for the map/reduce script.
idstringThe unique ID of the task.
paramsObjectKey-value pairs that override static script parameter field values on the script deployment record.
scriptIdnumberstring

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:

javascript
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 MapReduceScriptTask object simplifies asynchronous task management in NetSuite.
  • Use the submit() method to initiate map/reduce tasks effectively.
  • Monitor task status using the MapReduceScriptTaskStatus object to ensure processing efficiency.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Does the MapReduceScriptTask apply to both WMS and standard NetSuite environments?
The MapReduceScriptTask is part of the SuiteScript N/task module and is designed for use in the standard NetSuite environment. There is no indication provided that it specifically applies to WMS.
What permissions are required to use MapReduceScriptTask in SuiteScript?
The article does not specify the permissions required to use MapReduceScriptTask. It is recommended to check NetSuite’s official documentation or consult with a NetSuite administrator for permission details.
How can I monitor the status of a map/reduce task during execution?
You can monitor the status of a map/reduce task using the MapReduceScriptTaskStatus object. For instance, you can use the getCurrentTotalSize() method to retrieve the total size of work in progress.
Can I use parameters to override static script values when submitting a map/reduce script?
Yes, the MapReduceScriptTask object allows you to use the 'params' property to provide key-value pairs that override static script parameter field values on the script deployment record.
Source: MapReduceScriptTask Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →