Saurabh More
Saurabh More

Reputation: 423

NetSuite - CSV import status search

I want to get job status information of CSV imports in NetSuite by using SuiteScript. for this I used

search.create({
       type: search.Type.JOB_STATUS,
       filters: null,
       columns: ['internalid']
})

But I think I am using wrong search.

Upvotes: 0

Views: 1430

Answers (1)

wozzarvl
wozzarvl

Reputation: 364

You need the csv import ID, If you are using suitecript

create your import

 var scriptTask = task.create({taskType: task.TaskType.CSV_IMPORT});
 scriptTask.mappingId = 201; //Id for you saved import for example
 var file = file.load({id: fileId});       
 scriptTask.importFile = file;
  var csvImportTaskId = scriptTask.submit(); //Here you get de CSV Import Id

After you get the csvimport id you can query the status:

   var csvTaskStatus = task.checkStatus({
                       taskId: csvImportTaskId 
                         });
   if (csvTaskStatus.status === task.TaskStatus.FAILED)   // you code goes here

This is the status that you will get

  • PENDING
  • PROCESSING
  • COMPLETE
  • FAILED

If you query the status right after you submit the csv Import you will always get pending status, you shoud wait some time csv import gets into a queue and it takes time to start processi

Upvotes: 2

Related Questions