【发布时间】:2014-09-29 23:51:19
【问题描述】:
我想知道是否可以使用 nlapiLoadFile() 从服务器中的外部驱动器(公司内的服务器或本地驱动器)而不是文件柜中调用文件。 (必须手动上传哪个文件)?所以我可以使用它来使用 nlapiCreateCSVImport() 导入文件。
谢谢。
【问题讨论】:
标签: java javascript netsuite
我想知道是否可以使用 nlapiLoadFile() 从服务器中的外部驱动器(公司内的服务器或本地驱动器)而不是文件柜中调用文件。 (必须手动上传哪个文件)?所以我可以使用它来使用 nlapiCreateCSVImport() 导入文件。
谢谢。
【问题讨论】:
标签: java javascript netsuite
没有。您可以使用 nlapiRequestURL,它必须可以从外部服务器访问。
【讨论】:
@pipechang 这是我到目前为止得到的,当你说我需要将消息的正文转换为 JSON 时我不太明白 如果我将文件作为 XML 拉入,那么当我阅读正文时还需要将其转换为 JSON 吗?如果没有,我以后如何将其转换为 CSV?/
感谢您的帮助。
function scheduledimporting(type){
var csvMap = '15'; //saved CSV import id
//var csvFile = nlapiLoadFile("5828"); //csv file id from filecabinet
var urlrequest=nLapiRequestURL('https://...........',null,a);
var body=response.getBody(); //get the body of the message
var csvImport = nlapiCreateCSVImport();//creating a new csv import
/***
If the file that I'm pulling in is a CSV, would i get the body as CSV?
DO I still need to go through Prsing the body and transform it to JSON Object
If I do, how would I transfer it back to CSV ?
***/
csvImport.setMapping(csvMap);//setting import map
csvImport.setPrimaryFile(body.getValue());//file to be imported
csvImport.setOption("jobName", "Test1111");//setting job status' job name
var csvSubmitId = nlapiSubmitCSVImport(csvImport);//submitting the CSV
}
【讨论】: