NetSuite - CSV import status search

久未见 提交于 2021-02-11 12:22:57

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/63152421/netsuite-csv-import-status-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!