Rich Vann (www.richvann.com) provides automated conversion of version 1 suitescript to version 2 (for a reasonable fee). This tool automates about 95% of the conversion (varies depending on the nature of the NetSuite functions/objects used and the abstraction level of the javascript). The remainder of the conversion is done with some manual script changes and then those scripts are tested in a NetSuite account.
You can test some script conversions live at www.richvann.com - look for the “*** TRY IT OUT LIVE ***” button on the home page.
There are significant advantages with converting to version 2 scripts:
● Development staff can focus expertise on a single suitescript version
● Version 2 has some features not available in version 1
Map/Reduce Script Type (improved “scheduled” scripts)
Cache API
Vastly improved timezone-datetime handling
Asynchronous client-side processing (promises)
SFTP, Search pagination, Flat file streaming, new encryption/encoding functionality and more…
Any new features will not be implemented in version 1
● Modular programming model – better for large, complex projects
● Automatic dependency Management
● Modern programming syntax and behavior
● At some point NetSuite will likely deprecate version 1.
(avoid getting "stranded" by converting now!)
Besides the obvious labor/cost savings, the far greater benefit of an automated approach is the elimination of the large number of errors that would likely occur with a purely manual conversion process.
1. Install the SuiteScript 1to2 Conversion Launcher bundle
a. This bundle is publicly available to anyone (free)
2. Compile Script Configuration Data
a. Navigate to Customization, V1 to V2 Conversion, SuiteScript V1 to V2 Converter
b. Select a root folder containing the suitescripts to be converted
(all scripts must be in a single folder or immediate subfolder)
c. Enter a “RETURN EMAIL”
d. Submitting sends a "Conversion Request" containing the above script "meta-data" (libraries, entry point functions, etc) to rich@richvann.com.
3. Provide Script files
Send a zip file containing the scripts in the root folder and subfolders to rich@richvann.com (or use a file sharing service like www.mediafire.com or www.diawi.com).
4. Automated Conversion
Using the supplied script meta data and script files, the conversion tool is applied to these scripts which will convert about 95% of the script automatically.
5. Manual Conversion Process
Depending upon the abstraction of the javascript, it may be difficult to determine the data type of some variables. This will require the application of some “hints” to the source script and a some rearranging of function definitions.
6. Manual Creation of the SuiteScript 2 records and deployments in NetSuite Currently, RVC does not support the capability to automatically create the new version 2 script records and deployments and retire those for version 1 (but that is on the product road map to be available shortly).
7. Test the v2 Scripts
Test/debug the resulting v2 scripts.
8. Repeat as necessary
It may take a few iterations massaging the input script to get the maximal conversion.
In most cases, the converter determines the type of objects based on how they were created. Since javascript is not a “typed” language, it isn’t always immediately possible to determine that some variables represent NetSuite objects, for example across function calls. However, the conversion tool will note the data type of parameters used in calls to functions and thus “knows” the data type of those parameters if those functions are declared in the script after the point of where they are referenced. Thus it may be necessary to move the declaration of some functions to later in the script file. Alternatively, a simple statement can be added to the source script todefine the type of those variables or parameters - this statement has the following format:
var ss1to2_FLDTYPES = {var-name: data-type, ...};
for example (assuming variable or parameters “rec” and “result”):
var ss1to2_FLDTYPES = {rec:'nlobjRecord',result:'nlobjSearchResult'};
Note this “hint” line is removed from the converted javascript.
Rich charges a fee for his conversion service but, since it is based on an automated process, is a fraction of the cost of manual conversions (and without the attendant errors/bugs).