SuiteScript 1.0 to 2.1 reference
nlapiLoadFile in SuiteScript 2.1
In SuiteScript 2.1, nlapiLoadFile is replaced by file.load from N/file. Loads a File Cabinet file by id or path.
Before and after
// SuiteScript 1.0
var f = nlapiLoadFile(456);
var text = f.getValue();// SuiteScript 2.1
define(['N/file'], (file) => {
const f = file.load({ id: 456 });
const text = f.getContents();
});What to watch for
- A path such as 'SuiteScripts/config.json' works as the id.
Related functions
- nlapiCreateError becomes error.create
- nlapiLoadRecord becomes record.load
- nlapiCreateRecord becomes record.create
- All SuiteScript 1.0 functions
Find what still needs converting
Find every script that still calls nlapiLoadFile
SuiteMigrate lists the active 1.0 and 2.0 scripts in your NetSuite account, shows which ones you can read and which are locked, and drafts 2.1 conversions you review before deploying. Free for 5 conversions.
Examples are simplified. Test converted code in a NetSuite sandbox before deploying. SuiteMigrate is not affiliated with Oracle or NetSuite.