In this Suite.js example, the app makes calls to the NetSuite SuiteTalk REST API's "query" service. It sends a SuiteQL query that returns current inventory levels, by location, for all active inventory items. API calls are made until all of the data has been received.
When all of the data has been retceived, it is used to generate an Excel spreadsheet. The app uses the popular Sheet.js JavaScript library to create the spreadsheet.
The app also uses the Moment.js JavaScript library to help create the name of the Excel file that is saved to disk when the process completes.
var appStartTime = performance.now(); writeln; writeln( "------------------------------------------------------------------------------------------"); writeln( "NetSuite Inventory to Excel via SuiteTalk" ); writeln( "------------------------------------------------------------------------------------------"); writeln; // Require SheetJS ( https://sheetjs.com ) require( "shim.min.js" ); var XLSX = require( "xlsx.full.min.js" ); // Require Moment ( https://momentjs.com ) var moment = require( 'moment.min.js' ); // Load NetSuite Suitetalk credentials. var ns = require( "netsuite-creds-ironforge-suitetalk.js" ); // SuiteQL query to retrieve current inventory levels for all active inventory items, by location, // including item information, base and online prices. var query = <<
© 2024 Tim Dietrich.