task.create(options)
Method Description |
Creates a task object for the specified task type and returns the object. Use this method to create tasks to do the following:
|
Returns |
task.CsvImportTask | task.EntityDeduplicationTask | task.MapReduceScriptTask | task.QueryTask | task.RecordActionTask | task.ScheduledScriptTask | task.SearchTask | task.SuiteQLTask | task.WorkflowTriggerTask |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The type of task object to create. Use the task.TaskType enum to set the value. |
|
string |
optional |
The script ID (as a string) of the script deployment record. This parameter sets the value for the ScheduledScriptTask.deploymentId or MapReduceScriptTask.deploymentId property. This parameter is applicable only when |
|
Object | Array<string | boolean | number> |
optional |
An object that represents additional parameters and values for the task. This parameter accepts different values based on the value of the
This parameter sets the value for the ScheduledScriptTask.params, MapReduceScriptTask.params, WorkflowTriggerTask.params, or SuiteQLTask.params properties. This parameter is applicable only when |
|
number | string |
optional |
The internal ID (as a number) or script ID (as a string) for the script record. This parameter sets the value for the ScheduledScriptTask.scriptId or MapReduceScriptTask.scriptId property. This parameter is applicable only when |
|
file.File | string |
optional |
A CSV file to import. Use a file.File object or a string that represents the CSV text to be imported. This parameter sets the value for the CsvImportTask.importFile property. This parameter is applicable only when |
|
Object |
optional |
A map of key-value pairs that sets the data to be imported in a linked file for a multi-file import job, by referencing a file in the File Cabinet or the raw CSV data to import. The key is the internal ID of the record sublist for which data is being imported and the value is either a file.File object or the raw CSV data to import. You can assign multiple types of values to this property. This parameter sets the value for the CsvImportTask.linkedFiles property. This parameter is applicable only when |
|
number | string |
optional |
The internal ID (as a number) or script ID (as a string) of a saved import map created using the Import Assistant. See task.CsvImportTask. This parameter sets the value for the CsvImportTask.mappingId property. This parameter is applicable only when |
|
string |
optional |
The name for the CSV import task. You can optionally set a different name for a scripted import task. In the UI, this name appears on the CSV Import Job Status page. This parameter sets the value for the CsvImportTask.name property. This parameter is applicable only when |
|
number |
optional |
Overrides the Queue Number property under Advanced Options on the Import Options page of the Import Assistant. Use this property to programmatically select an import queue and improve performance during the import.
Note:
This property is only available if you have a SuiteCloud Plus license. For more information about using multiple queues when importing CSV files, see Queue Number and Use Multiple Threads and Multiple Queues to Run CSV Import Jobs. This parameter sets the value for the CsvImportTask.queueId property. This parameter is applicable only when |
|
string |
optional |
Sets the mode for merging or deleting duplicate records. This parameter sets the value for the EntityDeduplicationTask.dedupeMode property. This parameter is applicable only when Use the task.DedupeMode enum to set the value. |
|
string |
optional |
Sets the type of entity on which you want to merge duplicate records. This parameter sets the value for the EntityDeduplicationTask.entityType property. This parameter is applicable only when Use the task.DedupeEntityType enum to set the value.
Note:
If you specify a value of |
|
number |
optional |
When you merge duplicate records, you can delete all duplicates for a record or merge information from the duplicate records into the master record. Use this property to set the ID of the master record that you want to use as the master record in the merge.
Important:
You must also select SELECT_BY_ID for the EntityDeduplicationTask.masterSelectionMode property, or NetSuite ignores this setting. This parameter sets the value for the EntityDeduplicationTask.masterRecordId property. This parameter is applicable only when |
|
string |
optional |
When you merge duplicate records, you can delete all duplicates for a record or merge information from the duplicate records into the master record. Set this property to determine which of the duplicate records to keep or to select the master record to use by ID. This parameter sets the value for the EntityDeduplicationTask.masterSelectionMode property. This parameter is applicable only when Use the task.MasterSelectionMode enum to set the value. |
|
number[] |
optional |
The internal IDs of the records to perform the merge or delete operation on. You can use the search.duplicates(options) method to identify duplicate records or create an array with record internal IDs. This parameter sets the value for the EntityDeduplicationTask.recordIds property. This parameter is applicable only when |
|
number |
optional |
The internal ID of the base record. This parameter sets the value for the WorkflowTriggerTask.recordId property. This parameter is applicable only when |
|
string |
optional |
The record type of the workflow definition base record, such as customer, salesorder, or lead. In the Workflow Manager, this is the record type that is specified in the Record Type field. This parameter sets the value for the WorkflowTriggerTask.recordType property. This parameter is applicable only when |
|
number | string |
optional |
The internal ID (as a number) or script ID (as a string) for the workflow definition. This is the ID that appears in the ID field on the Workflow Definition Page. This parameter sets the value for the WorkflowTriggerTask.workflowId property. This parameter is applicable only when |
|
number |
optional |
The internal ID of the CSV file to export search results to. For more information about working with files, see N/file Module. This parameter is mutually exclusive with the This parameter sets the value for the SearchTask.fileId, QueryTask.fileId, or SuiteQLTask.fileId properties. This parameter is applicable only when |
|
string |
optional |
The path of the CSV file to export search results to. For more information about working with files, see N/file Module. This parameter is mutually exclusive with the This parameter sets the value for the SearchTask.filePath, QueryTask.filePath, or SuiteQLTask.filePath properties. This parameter is applicable only when |
|
query.Query | string |
optional |
The query definition for a query task or SuiteQL task. This parameter accepts different values based on the value of the
This parameter sets the value for the QueryTask.query or SuiteQLTask.query properties. This parameter is applicable only when |
|
string |
optional |
The internal ID of the saved search to be executed during the task. This parameter sets the value for the SearchTask.savedSearchId property. This parameter is applicable only when |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/task Module Script Samples.
// Add additional code ...
var mrTask = task.create({
taskType: task.TaskType.MAP_REDUCE,
scriptId: 34,
deploymentId: 'custdeploy1',
params: { doSomething: true }
});
...
// Add additional code