CsvImportTask Object for Asynchronous CSV Imports in NetSuite
CsvImportTask enables automated, asynchronous CSV data imports into NetSuite, crucial for integration and scheduling.
TL;DR Opening
The CsvImportTask object facilitates automated and asynchronous CSV imports into NetSuite, making it essential for developers who need to handle record data efficiently during SuiteApp installations, testing, or scheduled imports.
Overview of CsvImportTask Object
The CsvImportTask object is designed to manage CSV import tasks within NetSuite. This tool is pivotal for users who require automation and integration capabilities in their data handling processes. It supports various functionalities:
- Automate imports for SuiteApps, demos, and tests.
- Schedule imports using scripts.
- Integrate with RESTlets for CSV importation.
Importing CSV Data with CsvImportTask
To effectively use the CsvImportTask, follow these steps:
-
Set Up Import Mapping: Begin in the NetSuite UI by utilizing the Import Assistant, which helps define CSV mappings and options. It's critical to ensure that the necessary mapping is established, potentially using a sample file.
- Gather script IDs for the import map.
- Note any required linked files.
-
Create the Task: Use the
task.create(options)method to instantiate theCsvImportTaskobject. -
Configure Properties: Assign the appropriate import script and deployment properties to the
CsvImportTaskobject. -
Submit the Task: Execute the
CsvImportTask.submit()method to queue the task for processing. -
Check Status: Utilize the
task.CsvImportTaskStatusproperties to monitor the import's progress.
Import Limitations and Guidelines
While utilizing the CsvImportTask, keep in mind these essential guidelines:
- Each import is bound to a limit of 25,000 records.
- Data typically imported through (2-step) assistants in the UI cannot be handled by this object, as these imports do not allow saved mapping. This restriction includes certain record types, like budget entries and project tasks.
- The
CsvImportTaskhas access limited to saved field mappings and cannot utilize advanced options set in the Import Assistant, such as multi-threading. Regardless of prior settings, only a single thread and queue are employed for the submitted job.
Supported Script Types
The CsvImportTask is compatible with server scripts, which provides flexibility for backend processing.
Example Code
The following code demonstrates how to set up a CsvImportTask:
1//Add additional code 2...3var scriptTask = task.create({4 taskType: task.TaskType.CSV_IMPORT5});6scriptTask.mappingId = 51; 7var f = file.load('SuiteScripts/custjoblist.csv');8scriptTask.importFile = f;9scriptTask.linkedFiles = {'addressbook': 'street,city\nval1,val2', 10 'purchases': file.load('SuiteScripts/other.csv')};11var csvImportTaskId = scriptTask.submit();12...13//Add additional codeThis sample provides the necessary syntax for creating and submitting a CSV import task. For complete script examples, refer to additional resources on the N/task module.
Related Topics
For further reading, consider exploring the following topics:
- N/task Module
- SuiteScript 2.x Modules
Key Takeaways
- The
CsvImportTaskobject simplifies asynchronous CSV imports into NetSuite. - Automation and scheduling features enhance data handling efficiency.
- Be mindful of limitations regarding record counts and import mappings.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
How do I set up import mapping for CsvImportTask in NetSuite?
What are the limitations of using CsvImportTask in NetSuite?
Can I use multi-threading with CsvImportTask?
What script types are supported by CsvImportTask in NetSuite?
Was this article helpful?
More in CSV Import
- CSV Import Guidelines and Best Practices in NetSuite 2026.1
Review essential CSV import guidelines and best practices for NetSuite users in version 2026.1 to ensure accurate data integration.
- SaaS Metric End Date Field in NetSuite 2026.1
SaaS Metric End Date field impacts item imports in NetSuite 2026.1 for enhanced tracking and reporting.
- SaaS Fields Available for Items Import in NetSuite 2026.1
NetSuite 2026.1 introduces new SaaS fields for Items import, enhancing metric tracking capabilities for non-inventory and service items.
- Cash Refund Records Supported in CSV Import Assistant
Cash refund records can now be imported in bulk using the CSV Import Assistant, streamlining data migration and processing.
