N/currentRecord Module Members for SuiteScript Client Scripts
Utilize the N/currentRecord module to handle current records in SuiteScript client scripts effectively.
The N/currentRecord module allows SuiteScript developers to access and manipulate the active record within the current client context. This module operates using a dynamic object model, which means that any interactions with the current record reflect real-time changes. It's important to note that when the current record is in view mode, it is read-only, limiting any direct edits using set APIs.
Script Usage
The N/currentRecord module can be employed in various types of scripts:
- Entry Point Client Scripts: These scripts automatically receive a
currentRecord.CurrentRecordobject that abstracts the current record. To use it, define a variable and set it toscriptContext.currentRecord, which is available in all SuiteScript 2.x Client Script entry points. - Client Custom Modules: For these, you must manually load the module in the script's define statement and retrieve a record object using
currentRecord.get()orcurrentRecord.get.promise()methods.
Key Differences Between N/currentRecord and N/record Modules
While both modules allow access to body and sublist fields, N/currentRecord should primarily be used in client scripts targeting the currently active record. The N/record module is more appropriate for server-side scripts that interact with records not currently active.
Additionally, N/currentRecord restricts editing of subrecords when in view mode, though these subrecords can still be retrieved. For greater complexity or when working with multiple records, developers should prefer the N/record module.
N/currentRecord Module Members
Below is a summary of the members available in the N/currentRecord module:
| Member Type | Name | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
| Object | currentRecord.Column | Object | Client scripts | Encapsulates a column of a sublist on the current record. |
| Object | currentRecord.CurrentRecord | Object | Client scripts | Represents the record active on the current page. |
| Object | currentRecord.Field | Object | Client scripts | Represents a body or sublist field. |
| Object | currentRecord.Sublist | Object | Client scripts | Represents a sublist. |
| Method | currentRecord.get() | currentRecord.CurrentRecord | Client scripts | Retrieves a record object that represents the current record. |
| Method | currentRecord.get.promise() | Promise | Client scripts | Retrieves a promise for an object that represents the current record. |
Additional Information
When using the currentRecord capabilities, keep in mind the various properties and methods that allow interaction with sublists, fields, and line items. This flexibility is crucial for creating responsive and dynamic user experiences in your SuiteScript applications.
Source: This article is based on Oracle's official NetSuite documentation.
Key Takeaways
- Use the N/currentRecord module for real-time access to the current record in SuiteScript client scripts.
- Understand the differences between N/currentRecord and N/record modules to choose the appropriate one for your needs.
- Leverage the various methods available in the currentRecord module for effective record manipulation.
Frequently Asked Questions (4)
How can I retrieve a record object in a Client Custom Module using the N/currentRecord module?
Can I edit body fields of the current record when it is in view mode using the N/currentRecord module?
What is the primary use case for the N/currentRecord module in SuiteScript?
When should I use the N/record module instead of the N/currentRecord module?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Custom Tool Script Enhancements in NetSuite
Custom tool scripts in NetSuite gain execution log support and a new management page in February 16, 2026.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
