Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Need Help with first 2.0 Script FTP
Hello,
I am trying to do my first 2.0 script, and it is just downloading a file from an FTP. I made it a scheduled search and when I try to run it at the debugger I get the following:
Cannot find function createConnection in object [object Object].
/** * @NApiVersion 2.x * @NScriptType ScheduledScript * @NModuleScope SameAccount */ define(['N/file','N/sftp'], /** * @param {file} file * @param {sftp} sftp */ function(sftp,file) { function execute(context) { var myPwdGuid = "XXXXXXXXXX"; //var myHostKey = "XXXXXXXXXXXXXX"; var connection = sftp.createConnection({ username: 'usernameXX', passwordGuid: myPwdGuid, // references var myPwdGuid url: 'sft.testnet', directory: '/Outbound/', hostKey: myHostKey }); // download the file from the remote server var downloadedFile = connection.download({ directory: '/Outbound/', filename: 'test.csv' }); } return { execute: execute }; });
0