Confirm bundle installation, enable features, create account
This sample is a bundle installation script that makes sure the bundle being installed is version 2.0, and that the Work Orders and Multiple Currencies features are enabled, and then creates an account record.
The conversion of this script from SuiteScript 1.0 to SuiteScript 2.x includes the following:
-
JSDoc tags are added at the top of the script to indicate the script version and script type
-
The
define
statement is added which imports the N/runtime and N/error modules. -
The
return
statement is added with thebeforeInstall
,beforeUpdate
, andafterUpdate
entry points. -
The
beforeInstall
,beforeUpdate
, andafterUpdate
entry point functions are created. -
The
beforeInstall
,beforeUpdate
, andafterUpdate
entry point functions are converted to SuiteScript 2.x.-
The
toversion
argument is changed to theparams.toVersion
orparams.version
parameter. -
The
fromversion
argument is changed to theparams.fromVersion
parameter. -
The
nlapiCreateRecord
function is changed to therecord.create
method. -
The
setFieldValue
function is changed to theRecord.setValue
method. -
The
nlapiSubmitRecord
function is changed to theRecord.save
method.
-
-
The
checkFeatureEnabled
function is converted to SuiteScript 2.x.-
The
nlapiGetContext
function is no longer needed. -
The
getFeature
function is changed to theruntime.isFeatureInEffect
method. -
The
nlapiLogExecution
function is changed to thelog.debug
method. -
The
nlobjError
object is changed to theerror.create
method.
-
SuiteScript 1.0 Script |
SuiteScript 2.x Script |
---|---|
|
|