Set the sales rep on the record in a workflow
This sample is a user event script that sets the sales rep on the record in a workflow. To get a new record in SuiteScript 2.x, place this code in a user event script's beforeLoad, beforeSubmit, or afterSubmit entry point. For this example, the beforeLoad entry point is used.
The conversion of this script from SuiteScript 1.0 to SuiteScript 2.1 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/currentRecord and N/runtime modules. -
The
returnstatement is added with thebeforeLoadentry point. -
The
nlapiGetNewRecordfunction is changed tocontext.newRecord. -
The
nlapiGetContextandgetSettingfunctions are changed to theruntime.getCurrentScriptand theruntime.Script.getParametermethods. -
The
setFieldValuefunction is changed to theRecord.setValuemethod.
|
SuiteScript 1.0 Script |
SuiteScript 2.1 Script |
|---|---|
|
|