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, this code needs to be placed into a user event script in the 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
define
statement is added which imports the N/currentRecord and N/runtime modules. -
The
return
statement is added with thebeforeLoad
entry point. -
The
nlapiGetNewRecord
function is changed tocontext.newRecord.
-
The
nlapiGetContext
andgetSetting
functions are changed to theruntime.getCurrentScript
and theruntime.Script.getParameter
methods. -
The
setFieldValue
function is changed to theRecord.setValue
method.
SuiteScript 1.0 Script |
SuiteScript 2.1 Script |
---|---|
|
|