Converting a SuiteScript 1.0 Script to a SuiteScript 2.x Script
The general steps you take to convert a SuiteScript 1.0 script to a SuiteScript 2.x 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.x 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.x calls according to the SuiteScript 1.0 to SuiteScript 2.x 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.x call according to the SuiteScript 1.0 to SuiteScript 2.x API Map.
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.x by using JavaScript, such as Date functions.
-
Some functions and objects in SuiteScript 1.0 operate a little differently in SuiteScript 2.x, such as logging and printing. See the help topic Differences in Similar SuiteScript 1.0 and SuiteScript 2.x Capabilities.
-
Some function and objects in SuiteScript 1.0 do not completely map to any SuiteScript 2.x module, method, property, or enum. See the help topic SuiteScript 1.0 APIs Not Directly Mapped to a SuiteScript 2.x Module.
The Sample SuiteScript 1.0 to SuiteScript 2.0 and SuiteScript 2.1 Conversions help topic shows you a side-by-side comparison of SuiteScript 1.0 and SuiteScript 2.x scripts for each script type and custom modules.
If converting your SuiteScript 1.0 scripts to SuiteScript 2.x is not feasible in your situation, you can use SuiteScript 2.x RESTlet scripts to extend the capabilities of your existing SuiteScript 1.0 scripts. For more information, see Using SuiteScript 2.x Scripts with SuiteScript 1.0 Scripts.
Related Topics
- Transitioning from SuiteScript 1.0 to SuiteScript 2.x
- Overview of the Differences Between SuiteScript 1.0 and SuiteScript 2.x
- Differences Between SuiteScript 1.0 and SuiteScript 2.x Script Types
- SuiteScript 1.0 APIs Not Directly Mapped to a SuiteScript 2.x Module
- Differences in Similar SuiteScript 1.0 and SuiteScript 2.x Capabilities
- Sample SuiteScript 1.0 to SuiteScript 2.0 and SuiteScript 2.1 Conversions
- Using SuiteScript 2.x Scripts with SuiteScript 1.0 Scripts