如何上传文件到NetSuite的文件柜自动? [英] How to upload a file to Netsuite File Cabinet Automatically?
问题描述
如何上传文件到NetSuite的文件柜自动?
How can I upload a file to Netsuite File Cabinet automatically?
将 nLapiRequestURL(服务器1 /数据库1 / NDT / ftp.csv
工作?
文件是从公司内的一个服务器中提取。
File is to be fetched from a server within company.
我需要导入CSV文件柜,每天自动一次。
I need to import CSV file to the cabinet automatically once a day.
推荐答案
我觉得去这个最简单的方法是:
I think that the simplest way to go about this is:
- 将CSV文件导入公开显示的位置(显然,这只是工作,如果它不是敏感信息!请请请不要这样做,如果你不想让全世界的人都看看吧!)
- 创建于NetSuite的预定脚本。设置部署为每天运行,在任何时候,你认为最好的
- 在您的计划的脚本中,使用nlapiRequestUrl <一个href=\"https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteScript/ApplicationNavigationAPIs.html#bridgehead_N3059142\"相对=nofollow>(NS帮助文档)以获得无论你把它放在文件(注意,有一个5MB大小的限制!)
- 使用nlapiCreateFile <一个href=\"https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteScript/FileAPIs.html#bridgehead_N3067099\"相对=nofollow>(NS帮助文档)创建一个文件
- 使用nlapiSubmitFile <一个href=\"https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteScript/FileAPIs.html#bridgehead_N3067647\"相对=nofollow>(NS帮助文档)将其提交文件柜
- Place your CSV file into a location that is publicly visible(obviously, this only works if it's not sensitive information! PLEASE PLEASE PLEASE don't do this if you don't want the whole world to see it!)
- Create a scheduled script in NetSuite. Set the deployment to run daily, at whatever time you deem best
- In your scheduled script, use nlapiRequestUrl (NS help doc) to get the file from wherever you placed it (Note that there is a 5mb size limitation!)
- Use nlapiCreateFile (NS help doc) to create a file
- Use nlapiSubmitFile (NS help doc) to submit it to the file cabinet
样code:
var response = nlapiRequestURL('http://yourserver.yourcompany.com/somecsvfile.csv');
var csvDataInBase64 = response.getBody();
var file = nlapiCreateFile('mycsv.csv', 'CSV', csvDataInBase64);
nlapiSubmitFile(file);
有此样本中没有错误检查或任何东西,但它应该让你开始。
There is no error checking or anything in that sample, but it should get you started.
如果安全问题(见上文第1点!),你很可能最好关闭通过Web服务发送文件。见<一href=\"https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/SuiteTalkWebServices.html\" rel=\"nofollow\">https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/SuiteTalkWebServices.html了解更多信息。
If security matters(see point 1 above!), you are likely best off sending the file via web services. See https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/SuiteTalkWebServices.html for more information.
这篇关于如何上传文件到NetSuite的文件柜自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!