Converting a SuiteScript 1.0 Script to a SuiteScript 2.1 Script
The general steps you take to convert a SuiteScript 1.0 script to a SuiteScript 2.1 script depend on whether you are converting an entry point script or a custom module script.
-
If your script is for a specific script type, such as user event or client script, you will first need to edit the script so that the correct script type structure is in place. This includes adding JSDoc comments, the define function, and a return statement at a minimum. For more information about proper script structure, see the help topic SuiteScript 2.1 Anatomy of a Script.
-
After you place the script into the proper structure, you can start converting individual SuiteScript 1.0 calls into their corresponding SuiteScript 2.1 calls according to the SuiteScript 1.0 to SuiteScript 2.1 API Map. Note that this order is not a strict order of steps to take; however, you may find it easier to place the script into the proper script structure first and then convert each call statement.
-
If your script is a custom module and not a specific script type, you can convert each SuiteScript 1.0 call into its corresponding SuiteScript 2.1 call according to the SuiteScript 1.0 to SuiteScript 2.1 API Map.
After you convert and upload a SuiteScript 2.1 script file, update the existing SuiteScript 1.0 script record to use the converted file. When you save the script record, NetSuite updates the SuiteScript API Version field to 2.1. The converted file must use the same script type as the existing script record.
Here are a few additional notes to consider when converting your scripts:
-
Some functions and objects in SuiteScript 1.0 are now supported in SuiteScript 2.1 by using JavaScript, such as Date functions.
-
Some functions and objects in SuiteScript 1.0 operate a little differently in SuiteScript 2.1, such as logging and printing. See the help topic SuiteScript 1.0 and SuiteScript 2.1 Differences.
-
Some function and objects in SuiteScript 1.0 do not completely map to any SuiteScript 2.1 module, method, property, or enum. See the help topic SuiteScript 1.0 APIs Not Directly Mapped to a SuiteScript 2.1 Module.
The Sample SuiteScript 1.0 to SuiteScript 2.1 Conversions help topic shows you side-by-side comparisons for SuiteScript 1.0 and SuiteScript 2.1 scripts for each script type and custom modules.
Related Topics
- Transitioning from SuiteScript 1.0 to SuiteScript 2.1
- SuiteScript 1.0 and SuiteScript 2.1 Differences
- SuiteScript 1.0 and SuiteScript 2.1 Script Type Differences
- SuiteScript 1.0 APIs Not Directly Mapped to a SuiteScript 2.1 Module
- SuiteScript 1.0 and SuiteScript 2.1 Differences
- Sample SuiteScript 1.0 to SuiteScript 2.1 Conversions