Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading a file to Netsuite using Node.js

So I am testing out a script that comes with an npm module that will upload a NetSuite file to the File Cabinet. Here is a link to the npm module called nsupload. The instructions say to upload the Restlet included in the module to Netsuite and set the function in the RESTlet in the PUT method in Netsuite. When I run the script on my end to upload a file to the Netsuite File Cabinet I get the error "TypeError: sendToNetsuite is not a function."

Here is the test code the module supplies:

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);
});

EDIT: I changed the npm module I was using to the one called nscabinet. This stoo came with a sample code for uploading a file to Netsuite. Here's the code to that:

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


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

I left out a few parameters but I don't believe they make a difference. At the moment the error I keep getting is "SSS_INVALID_SCRIPTLET_ID - That Suitelet is invalid, disabled, or no longer exists." I have upload the Restlet that came with it to Netsuite as well but the problem persists.

Again, I have looked up the error but I still haven't figured out what the problem is. I tried testing the code within the code I wanted to use and by itself when it didn't work. Any ideas on solving this?

Thanks!

like image 956
VicDid Avatar asked Feb 21 '26 13:02

VicDid


1 Answers

Change your script option to the script id of the Restlet you uploaded to NetSuite.

gulp.src('foo.js')
.pipe(nscabinet({
    email : '[email protected]' ,
    password : '123456' ,
    account : '123456' ,
   // realm : 'sandbox.netsuite.com' ,
    //role : 3 ,
    rootPath : '/SuiteScripts',
    script : 1234 ,
    deployment : 2
}))
like image 172
Rich Long Avatar answered Feb 23 '26 03:02

Rich Long



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!