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
definestatement is added which imports the N/runtime and N/error modules. -
The
returnstatement is added with thebeforeInstall,beforeUpdate, andafterUpdateentry points. -
The
beforeInstall,beforeUpdate, andafterUpdateentry point functions are created. -
The
beforeInstall,beforeUpdate, andafterUpdateentry point functions are converted to SuiteScript 2.x.-
The
toversionargument is changed to theparams.toVersionorparams.versionparameter. -
The
fromversionargument is changed to theparams.fromVersionparameter. -
The
nlapiCreateRecordfunction is changed to therecord.createmethod. -
The
setFieldValuefunction is changed to theRecord.setValuemethod. -
The
nlapiSubmitRecordfunction is changed to theRecord.savemethod.
-
-
The
checkFeatureEnabledfunction is converted to SuiteScript 2.x.-
The
nlapiGetContextfunction isn't needed anymore. -
The
getFeaturefunction is changed to theruntime.isFeatureInEffectmethod. -
The
nlapiLogExecutionfunction is changed to thelog.debugmethod. -
The
nlobjErrorobject is changed to theerror.createmethod.
-
|
SuiteScript 1.0 Script |
SuiteScript 2.x Script |
|---|---|
|
|