CurrentRecord Module in NetSuite

Use the N/currentRecord module to access the record that is active in the current client context. This module is always a dynamic object and mode of work is always dynamic, not deferred dynamic/standard.

You can use the currentRecord module in the following types of scripts:

  • Entry point client scripts — These scripts use the @NScriptType Client Script annotation. The system automatically provides this type of script with a currentRecord.CurrentRecord object that represents the current record. For this reason, an entry point client script does not have to explicitly load the N/currentRecord module. To access the currentRecord object, create a variable and initialize it to the value of the scriptContext.currentRecord property, which is available in each of the SuiteScript 2.x Client Script Entry Points and API.
  • Client custom modules — These scripts do not use an @NScriptType annotation (see SuiteScript 2.x Custom Modules). For these scripts, you must manually load the N/currentRecord module by naming it in the script’s define statement. Additionally, you must actively retrieve a currentRecord.CurrentRecord object by using the currentRecord.get() or currentRecord.get.promise() method.

Note: The currentRecord module does not permit the editing of subrecords, although subrecords can be retrieved in view mode

Leave a comment

Your email address will not be published. Required fields are marked *