Differences Between SuiteScript 1.0 and SuiteScript 2.x Script Types
SuiteScript 2.x includes all the script types from SuiteScript 1.0. Plus, SuiteScript 2.x adds two more script types: map/reduce and SDF installation scripts.
In SuiteScript 1.0, the term 'event types' is used to describe how a script was triggered. In SuiteScript 2.x, it's now called an 'entry point'. All SuiteScript 2.x scripts have defined entry points, which generally map directly to the event types supported by the same script type in SuiteScript 1.0. For more information about SuiteScript 2.x entry points, see SuiteScript 2.x Entry Point Script Creation and Deployment.
See the following help topics for specific information about the differences in each script type:
For more information about specific SuiteScript 2.x script types, see the following help topics:
Bundle Installation Script Type Differences
The only difference between bundle installation scripts in SuiteScript 1.0 and bundle installation scripts in SuiteScript 2.x is that the toversion parameter in SuiteScript 1.0 event types is now called version in the beforeInstall, afterInstall, and beforeUninstall entry points in SuiteScript 2.x.
For more information about the bundle installation script type in SuiteScript 2.x, see SuiteScript 2.x Bundle Installation Script Type.
SuiteBundler is still supported, but it will not be updated with any new features.
To take advantage of new features for packaging and distributing customizations, you can use the Copy to Account and SuiteCloud Development (SDF) features instead of SuiteBundler.
Copy to Account is an administrator tool that you can use to copy custom objects between your accounts. The tool can copy one custom object at a time, including dependencies and data. For more information, see Copy to Account.
SuiteCloud Development Framework is a development framework that you can use to create SuiteApps from an integrated development environment (IDE) on your local computer. For more information, see SuiteCloud Development Framework.
Client Script Type Differences
Here’s how client scripts differ between SuiteScript 1.0 and 2.x:
-
In SuiteScript 2.x, a client script includes a new parameter:
currentRecord. -
In SuiteScript 2.x, the
fieldChangedentry point includes a new parameter:column. -
The
typeparameter in the SuiteScript 1.0pageInitevent type is calledmodein the SuiteScript 2.xpageInitentry point. -
The
recalcevent type in SuiteScript 1.0 is now thesublistChangedentry point in SuiteScript 2.x. -
In SuiteScript 2.x, the
validateDeleteentry point includes a new parameter:lineCount. -
In SuiteScript 2.x, the
validateFieldentry point includes a new parameter:column. -
In SuiteScript 2.x, there are two new entry points:
localizationContextEnterandlocalizationContextExit.
For more information about the client script type in SuiteScript 2.x, see SuiteScript 2.x Client Script Type.
Map/Reduce Script Type Differences
The map/reduce script is a new script type for SuiteScript 2.x that is designed for scripts that need to handle large amounts of data. It is best suited for situations where the data can be divided into small, independent parts. There’s no equivalent script type in SuiteScript 1.0.
For more information about the map/reduce script type in SuiteScript 2.x, see SuiteScript 2.x Map/Reduce Script Type.
Mass Update Script Type Differences
Here’s how mass update scripts differ between SuiteScript 1.0 and 2.x:
-
In SuiteScript 2.x, a mass update script includes the
eachentry point. There is no equivalent event type in SuiteScript 1.0. -
The
rec_typeandrec_idparameters used in SuiteScript 1.0 mass update scripts are replaced withparams.idandparams.typeparameters for theeachentry point in SuiteScript 2.x.
For more information about the mass update script type in SuiteScript 2.x, see SuiteScript 2.x Mass Update Script Type.
Portlet Script Type Differences
Here’s how portlet scripts differ between SuiteScript 1.0 and 2.x:
-
In SuiteScript 2.x, you can use a portlet for a SuiteApp.
-
In SuiteScript 2.x, a portlet script includes the
renderentry point. There is no equivalent event type in SuiteScript 1.0. -
The following methods are included in a SuiteScript 1.0
nlobjPortletobject, but are not included in the SuiteScript 2.xPortletobject:setRefreshInterval(n),setScript(scriptId). -
The following functions included in a SuiteScript 1.0
nlobjPortletobject are now properties in a SuiteScript 2.xPortletobject:-
The
setHtml(html)function in SuiteScript 1.0 is thePortlet.htmlproperty in SuiteScript 2.x.
-
The
setTitle(title)function in SuiteScript 1.0 is thePortlet.titleproperty in SuiteScript 2.x.
-
-
The parameters for the
nlPortletObject.addcolumnmethod have different names in thePortlet.addColumnmethod in SuiteScript 2.x:-
The
nameparameter in SuiteScript 1.0 is theidparameter in SuiteScript 2.x.
-
The
justparameter in SuiteScript 1.0 is thealignparameter in SuiteScript 2.x.
-
-
The
Portlet.addEditColumnmethod in SuiteScript 2.x has new parameters:link,linkParam, andlinkParamName. -
The
nameparameter for the SuiteScript 1.0nlPortletObject.addFieldmethod is now calledidin the SuiteScript 2.xPortlet.addFieldmethod. -
The
indentparameter for the SuiteScript 1.0nlPortletObject.addLinemethod is now calledalignin the SuiteScript 2.xPortlet.addFieldmethod. -
SuiteScript 2.x portlet scripts include two new properties:
Portlet.clientScriptFileIdandPortlet.clientScriptModulePath.
For more information about the portlet script type in SuiteScript 2.x, see SuiteScript 2.x Portlet Script Type.
RESTlet Script Type Differences
The only difference between RESTlet scripts in SuiteScript 1.0 and RESTlet scripts in SuiteScript 2.x is that the RESTlet in SuiteScript 2.x includes the delete, get, post, and put entry points. These entry points are equivalent to the delete, get, put, and post functions (http methods) in SuiteScript 1.0.
-
In SuiteScript 2.x, a RESTlet includes the
delete,get,post, andputentry points. These entry points are equivalent to thedelete,get,put, andpostfunctions (http methods) in SuiteScript 1.0.
The SuiteScript 2.x documentation for RESTlet script error handling includes more detail than previously provided for SuiteScript 1.0. For more information about error handling with RESTlet scripts, see SuiteScript 2.x RESTlet Error Handling.
For more information about the client script type in SuiteScript 2.x, see the help topic SuiteScript 2.x RESTlet Script Type.
Scheduled Script Type Differences
Here’s how scheduled scripts differ between SuiteScript 1.0 and 2.x:
-
In SuiteScript 2.x, a scheduled script includes the
executeentry point. There is no equivalent event type in SuiteScript 1.0. -
The SuiteScript 1.0
nlapiScheduleScriptfunction is replace with the SuiteScript 2.xtask.create(options)andtask.ScheduledScriptTask -
The
typeparameter in the SuiteScript 1.0nlapiScheduledScriptmethod is replaced with thecontext.InvocationTypeenum in SuiteScript 2.x. The values are similar:SCHEDULED,ON_DEMAND,USER_INTERFACE,ABORTED, andSKIPPED. -
The
nlapiSetRecoverPointfunction in SuiteScript 1.0 has no SuiteScript 2.x equivalent. The functionality provided by this function is not needed because of the way scheduled scripts execute in SuiteScript 2.x. -
The
nlapiYieldScriptfunction in SuiteScript 1.0 has not SuiteScript 2.x equivalent. The functionality provided by this function is not needed because of the way scheduled scripts execute in SuiteScript 2.x.
For more information about the scheduled script type in SuiteScript 2.x, see SuiteScript 2.x Scheduled Script Type.
SDF Installation Script Type Differences
The SDF installation script is a new script type for SuiteScript 2.x that is used to perform tasks during deployment of a SuiteApp from the SuiteCloud Development Framework (SDF) to a target account. There is no equivalent SuiteScript 1.0 script type.
For more information about the SDF installation script type in SuiteScript 2.x, see SuiteScript 2.x SDF Installation Script Type.
Suitelet Script Type Differences
The only difference between Suitelet scripts in SuiteScript 1.0 and Suitelet scripts in SuiteScript 2.x is that in SuiteScript 2.x, a Suitelet includes the onRequest entry point. There is no equivalent event type in SuiteScript 1.0.
For more information about the Suitelet script type in SuiteScript 2.x, see SuiteScript 2.x Suitelet Script Type.
User Event Script Type Differences
Here’s how user event scripts differ between SuiteScript 1.0 and 2.x:
-
The
beforeLoadentry point in SuiteScript 2.x includes a new parameter:newRecord. -
The
beforeSubmitentry point in SuiteScript 2.x includes two new parameters:oldRecordandnewRecord. -
The
afterSubmitentry point in SuiteScript 2.x includes two new parameters:oldRecordandnewRecord. -
The
typeparameter in each entry point in SuiteScript 2.x is now set using thecontext.UserEventTypeenum.
For more information about the user event script type in SuiteScript 2.x, see SuiteScript 2.x User Event Script Type.
Workflow Action Script Type Differences
Here’s how workflow action scripts differ between SuiteScript 1.0 and 2.x:
-
In SuiteScript 2.x, a workflow action script includes the
onActionentry point. There is no equivalent event type for in SuiteScript 1.0. -
The
idparameter in SuiteScript 1.0 is calledworkflowIdin SuiteScript 2.x. -
There are two new parameters in SuiteScript 2.x:
newRecordandoldRecord.
For more information about the workflow action script type in SuiteScript 2.x, see SuiteScript 2.x Workflow Action Script Type.