NetSuite - CSV 导入状态搜索 [英] NetSuite - CSV import status search

查看:83
本文介绍了NetSuite - CSV 导入状态搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 SuiteScript 在 NetSuite 中获取 CSV 导入的作业状态信息.为此我使用了

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.

推荐答案

您需要 csv 导入 ID,如果您使用的是suitecript

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

创建您的导入

 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

获得 csvimport 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

这是你会得到的状态

  • 待定
  • 处理
  • 完成
  • 失败

如果您在提交 csv 导入后立即查询状态,您将始终处于待处理状态,您应该等待一段时间 csv 导入进入队列并且需要时间来启动进程

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

这篇关于NetSuite - CSV 导入状态搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆