Differences Between SuiteScript 1.0 and SuiteScript 2.x Script Types
All script types available in SuiteScript 1.0 are also available in SuiteScript 2.x. Plus, SuiteScript 2.x has two additional script types: map/reduce script and SDF installation script.
In SuiteScript 1.0, the term 'event types' is used to describe how a script was triggered. In SuiteScript 2.x, this term is now '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
The differences between client scripts in SuiteScript 1.0 and client scripts in SuiteScript 2.x are:
-
In SuiteScript 2.x, a client script includes a new parameter:
currentRecord
. -
In SuiteScript 2.x, the
fieldChanged
entry point includes a new parameter:column
. -
The
type
parameter in the SuiteScript 1.0pageInit
event type is calledmode
in the SuiteScript 2.xpageInit
entry point. -
The
recalc
event type in SuiteScript 1.0 is now thesublistChanged
entry point in SuiteScript 2.x. -
In SuiteScript 2.x, the
validateDelete
entry point includes a new parameter:lineCount
. -
In SuiteScript 2.x, the
validateField
entry point includes a new parameter:column
. -
In SuiteScript 2.x, there are two new entry points:
localizationContextEnter
andlocalizationContextExit
.
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 is no equivalent SuiteScript 1.0 script type.
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
The differences between mass update scripts in SuiteScript 1.0 and mass update scripts in SuiteScript 2.x are:
-
In SuiteScript 2.x, a mass update script includes the
each
entry point. There is no equivalent event type in SuiteScript 1.0. -
The
rec_type
andrec_id
parameters used in SuiteScript 1.0 mass update scripts are replaced withparams.id
andparams.type
parameters for theeach
entry 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
The differences between portlet scripts in SuiteScript 1.0 and portlet scripts in SuiteScript 2.x are:
-
In SuiteScript 2.x, a portlet can now be used for a SuiteApp.
-
In SuiteScript 2.x, a portlet script includes the
render
entry point. There is no equivalent event type in SuiteScript 1.0. -
The following methods are included in a SuiteScript 1.0
nlobjPortlet
object, but are not included in the SuiteScript 2.xPortlet
object:setRefreshInterval(n)
,setScript(scriptId)
. -
The following functions included in a SuiteScript 1.0
nlobjPortlet
object are now properties in a SuiteScript 2.xPortlet
object:-
The
setHtml(html)
function in SuiteScript 1.0 is thePortlet.html
property in SuiteScript 2.x.
-
The
setTitle(title)
function in SuiteScript 1.0 is thePortlet.title
property in SuiteScript 2.x.
-
-
The parameters for the
nlPortletObject.addcolumn
method have different names in thePortlet.addColumn
method in SuiteScript 2.x:-
The
name
parameter in SuiteScript 1.0 is theid
parameter in SuiteScript 2.x.
-
The
just
parameter in SuiteScript 1.0 is thealign
parameter in SuiteScript 2.x.
-
-
The
Portlet.addEditColumn
method in SuiteScript 2.x has new parameters:link
,linkParam
, andlinkParamName
. -
The
name
parameter for the SuiteScript 1.0nlPortletObject.addField
method is now calledid
in the SuiteScript 2.xPortlet.addField
method. -
The
indent
parameter for the SuiteScript 1.0nlPortletObject.addLine
method is now calledalign
in the SuiteScript 2.xPortlet.addField
method. -
In SuiteScript 2.x, the portlet script includes two new properties:
Portlet.clientScriptFileId
andPortlet.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
, andput
entry points. These entry points are equivalent to thedelete
,get
,put
, andpost
functions (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
The differences between scheduled scripts in SuiteScript 1.0 and scheduled scripts in SuiteScript 2.x are:
-
In SuiteScript 2.x, a scheduled script includes the
execute
entry point. There is no equivalent event type in SuiteScript 1.0. -
The SuiteScript 1.0
nlapiScheduleScript
function is replace with the SuiteScript 2.xtask.create(options)
andtask.ScheduledScriptTask
-
The
type
parameter in the SuiteScript 1.0nlapiScheduledScript
method is replaced with thecontext.InvocationType
enum in SuiteScript 2.x. The values are similar:SCHEDULED
,ON_DEMAND
,USER_INTERFACE
,ABORTED
, andSKIPPED
. -
The
nlapiSetRecoverPoint
function 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
nlapiYieldScript
function 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
The differences between user event scripts in SuiteScript 1.0 and user event scripts in SuiteScript 2.x are:
-
The
beforeLoad
entry point in SuiteScript 2.x includes a new parameter:newRecord
. -
The
beforeSubmit
entry point in SuiteScript 2.x includes two new parameters:oldRecord
andnewRecord
. -
The
afterSubmit
entry point in SuiteScript 2.x includes two new parameters:oldRecord
andnewRecord
. -
The
type
parameter in each entry point in SuiteScript 2.x is now set using thecontext.UserEventType
enum.
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
The differences between workflow action scripts in SuiteScript 1.0 and workflow action scripts in SuiteScript 2.x are:
-
In SuiteScript 2.x, a workflow action script includes the
onAction
entry point. There is no equivalent event type for in SuiteScript 1.0. -
The
id
parameter in SuiteScript 1.0 is calledworkflowId
in SuiteScript 2.x. -
There are two new parameters in SuiteScript 2.x:
newRecord
andoldRecord
.
For more information about the workflow action script type in SuiteScript 2.x, see SuiteScript 2.x Workflow Action Script Type.