task.CsvImportTask

Note:

The content in this help topic pertains to SuiteScript 2.0.

Object Description

The properties of a CSV import task. Use the methods and properties for this object to submit a CSV import task into the task queue and asynchronously import record data into NetSuite.

Use the CsvImportTask Object to perform the following types of tasks:

  • Automate standard record data import for SuiteApp installations, demo environments, and testing environments.

  • Import data on a schedule using a scheduled script.

  • Build integrated CSV imports with RESTlets.

Use the following process to import CSV data with CsvImportTask:

  • In the NetSuite UI, run the Import Assistant to set up the CSV mapping and import options. You must run the Import Assistant to set up the necessary mapping for the CSV import. You can use a sample file or files to set up the mapping. Note the following information:

    • Script ID for import map.

    • Any required linked files.

    For more information, see Importing CSV Files with the Import Assistant.

  • Use task.create(options) to create the CsvImportTask object.

  • Use the CsvImportTask object properties to set the script and deployment properties.

  • Use CsvImportTask.submit() to submit the import task to the NetSuite task queue.

  • Use the properties for the task.CsvImportTaskStatus object to get the status of the import process.

Use the following guidelines with the CsvImportTask Object:

  • CSV imports performed within scripts are subject to the existing application limit of 25,000 records.

  • You cannot import data that is imported by (2-step) assistants in the UI, because these import types do not support saved import maps. This limitation applies to budget, single journal entry, single inventory worksheet, project tasks, and website redirects imports.

  • This object has access only to the field mappings of a saved import map; it does not have access to advanced import options defined in the Import Assistant, such as multi-threading and multiple queues.

    Even if you set options to use multiple threads or queues for an import job and then save the import map, these settings are not available to CsvImportTask. When this object submits a CSV import job based on the saved import map, a single thread and single queue are used.

For a complete list of this object’s methods and properties, see CsvImportTask Object Members.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/task Module

Since

2015.2

Syntax
Important:

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 scriptTask = task.create({taskType: task.TaskType.CSV_IMPORT});
scriptTask.mappingId = 51; 
var f = file.load('SuiteScripts/custjoblist.csv');
scriptTask.importFile = f;
scriptTask.linkedFiles = {'addressbook': 'street,city\nval1,val2', 'purchases': file.load('SuiteScripts/other.csv')};
var csvImportTaskId = scriptTask.submit();
...
//Add additional code 

        

Related Topics

N/task Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices