currentRecord.CurrentRecord
Object Description |
Encapsulates the record active on the current page. |
Supported Script Types |
Client scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2016.2 |
Syntax
The following code samples show the syntax for this member. These samples are not a functional examples. For a complete script example, see N/currentRecord Module Script Samples and SuiteScript Client Script Sample.
The following sample shows the retrieval of a currentRecord object in a custom module where the currentRecord was explicitly loaded.
//Add additional code
...
var objRecord = currentRecord.get();
...
//Add additional code
In an entry point client script, you do not have use the get method to retrieve the current record. (An entry point client script is one that uses the @NScriptType
ClientScript
annotation.) In these scripts, a currentRecord object is automatically created when the script is loaded. It is part of the context object that passed to each of the client script type’s entry points. However, you do have to create a variable to represent the current record, as shown in the following sample.
//Add additional code
...
function pageInit(context) {
var currentRec = context.currentRecord;
...
//Add additional code