N/task Module

The N/task module in SuiteScript 2.0 is used for managing tasks such as map/reduce jobs, scheduled scripts, and other task-based processes within NetSuite. This module allows you to create, submit, and check the status of these tasks programmatically.

A brief overview of what you can do with the N/task module:

  1. Map/Reduce Script: This type of script is used for batch processing of large data sets. The N/task module helps you manage the execution of these scripts.
  2. Scheduled Script: This type of script runs on a predefined schedule. The N/task module can be used to submit and monitor these scripts.
  3. Workflow Action Script: This type of script is used in workflows to automate actions.

Sample code snippet:

let mrTask = task.create({

                                taskType: task.TaskType.MAP_REDUCE,

                                scriptId: MR_SCRIPT_ID,

                                deploymentId: MR_DEPLOYMENT_ID,

                                params: {

                                    custscript_jj_folder_id : FOLDER_ID

                                }

                            });

Here folder id is passed as the parameter that trigger the map reduce script

Leave a comment

Your email address will not be published. Required fields are marked *