簡體   English   中英

使用Node.js將文件上載到Netsuite

[英]Uploading a file to Netsuite using Node.js

所以我正在測試一個帶有npm模塊的腳本,該模塊將NetSuite文件上傳到文件櫃。 這是一個名為 nsupload的npm模塊的鏈接。 說明說將模塊中包含的Restlet上傳到Netsuite,並在Netsuite的PUT方法中設置RESTlet中的函數。 當我在我的端部運行腳本將文件上傳到Netsuite文件櫃時,我收到錯誤“TypeError:sendToNetsuite不是一個函數”。

這是模塊提供的測試代碼:

var sendToNetsuite = require('nsupload')
  .config({
    email: 'email',
    password: 'pass',
    account: 'account number',
    script: 'script number',
    method: 'PUT'
  });

sendToNetsuite('./foo.json', function(err, body) {
  console.log('Success!');
  console.log(body);
});

編輯:我將我正在使用的npm模塊更改為名為nscabinet的模塊 這個stoo帶有一個示例代碼,用於將文件上傳到Netsuite。 這是代碼:

var nscabinet = require('nscabinet') ,
gulp = require('gulp') //or just vinyl-fs 


gulp.src('foo.js')
    .pipe(nscabinet({
        email : 'foo@bar.baz.com' ,
        password : '123456' ,
        account : '123456' ,
       // realm : 'sandbox.netsuite.com' ,
        //role : 3 ,
        rootPath : '/SuiteScripts',
        script : 'myuploadfile' ,
        deployment : 2
    }))

我遺漏了一些參數,但我不相信它們有所作為。 目前我不斷收到的錯誤是“SSS_INVALID_SCRIPTLET_ID - 該Suitelet無效,已禁用或已不存在”。 我已經將隨附的Restlet上傳到Netsuite,但問題仍然存在。

我再次查看了錯誤,但我仍然沒有弄清楚問題是什么。 我嘗試在我想要使用的代碼中測試代碼,並在它不起作用時自行測試。 解決這個問題的任何想法?

謝謝!

script選項更改為您上傳到NetSuite的Restlet的script ID。

gulp.src('foo.js')
.pipe(nscabinet({
    email : 'foo@bar.baz.com' ,
    password : '123456' ,
    account : '123456' ,
   // realm : 'sandbox.netsuite.com' ,
    //role : 3 ,
    rootPath : '/SuiteScripts',
    script : 1234 ,
    deployment : 2
}))

輸出console.log(inspect(sendToNetsuite)); 它沒有定義或不是函數。 這里的repo是私有的https://github.com/truecloud-com/nsupload - 也許聯系TrueCloud / Netsuite。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM