javascript - 如何自动上传文件到Netsuite文件柜?

标签 javascript import automation scheduled-tasks netsuite

如何自动将文件上传到 Netsuite 文件柜?

nLapiRequestURL("Server1/database1/NDT/ftp.csv工作?

文件将从公司内部的服务器获取。

我需要每天自动将CSV文件导入内阁一次。

最佳答案

我认为最简单的方法是:

  1. 将您的 CSV 文件放入公开可见的位置(显然,这仅在不是敏感信息时才有效!如果您不想让全世界都看到它,请不要这样做!)<
  2. 在 NetSuite 中创建计划脚本。将部署设置为每天运行,无论您认为什么时间最好
  3. 在您的计划脚本中,使用 nlapiRequestUrl (NS help doc)从您放置的位置获取文件(请注意,有 5mb 大小限制!)
  4. 使用 nlapiCreateFile (NS help doc)创建一个文件
  5. 使用 nlapiSubmitFile (NS help doc)将其提交至文件柜

示例代码:

var response = nlapiRequestURL('http://yourserver.yourcompany.com/somecsvfile.csv');
var csvDataInBase64 = response.getBody();
var file = nlapiCreateFile('mycsv.csv', 'CSV', csvDataInBase64);
nlapiSubmitFile(file);

该示例中没有错误检查或任何内容,但它应该可以帮助您入门。

如果安全很重要(请参阅上面的第 1 点!),您可能最好通过网络服务发送文件。请参阅https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/SuiteTalkWebServices.html了解更多信息。

关于javascript - 如何自动上传文件到Netsuite文件柜?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26289397/

相关文章:

javascript - 无法读取嵌套函数内 'get' $http 的属性

excel - 如何使用列名和行名将Excel数据导入R

Mysql导入缩短csv字符串值

testing - 在 testcafe 中捕获数据属性

c# - 使用 UI 自动化更改 WinForms 组合框选择

python - 对嵌套文件夹结构机器人框架中的多个测试套件使用通用套件设置和套件拆解

javascript - Ember JS : Value assigned through JQuery or JavaScript not reflected in model

javascript - d3.js 按索引在特定点向折线图添加垂直线

javascript - 在 Ember 中更改模板时如何运行 JQuery 代码?

java - 为什么要定义多个导入?