Get Current Sublist Value in SuiteScript 2.1
Retrieve values from sublist fields using SuiteScript 2.1's currentRecord module. Essential for client scripts.
TL;DR
You can obtain the value of a specific sublist field on the currently selected sublist line using the currentRecord module in SuiteScript 2.1. This is particularly useful for client scripts that need to interact with sublists on forms.
Method Description
The getCurrentSublistValue function returns the value of a given sublist field on the active line of a specified sublist. The value returned could be of types: number, date, string, array, or boolean.
Supported Script Types
- Client scripts
Governance
No governance limitations apply to this operation.
Parameters
The options parameter for this function is a JavaScript object that requires specific attributes:
| Parameter | Type | Required/Optional | Description |
|---|---|---|---|
options.sublistId | string | Required | The internal ID of the sublist. This value can be found in the Records Browser. |
options.fieldId | string | Required | The internal ID of the sublist field, which can be standard or custom. |
Errors
When using this method, the following errors may occur:
SSS_INVALID_SUBLIST_OPERATION: Triggered if a required argument is invalid or if the sublist is not editable.SSS_MISSING_REQD_ARGUMENT: Occurs when any required argument is missing or undefined.
Syntax
Here is how to correctly implement the getCurrentSublistValue in your SuiteScript:
1//Add additional code 2...3var sublistValue = objRecord.getCurrentSublistValue({4 sublistId: 'item',5 fieldId: 'item'6});7...8//Add additional codeMake sure to replace 'item' with your actual sublist and field IDs as necessary.
Who This Affects
- Developers: Those writing client scripts that need to interact with sublists on customer forms.
- Administrators: Users managing SuiteScript within their NetSuite environment.
Key Takeaways
- The
getCurrentSublistValuemethod allows you to retrieve field values from sublists. - Both
sublistIdandfieldIdparameters are mandatory. - This method is critical for client-side operations in SuiteScript 2.1 scripts.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Do I need to enable any specific feature flag to use getCurrentSublistValue in SuiteScript 2.1?
What types of values can getCurrentSublistValue return in SuiteScript 2.1?
What are the required parameters for using getCurrentSublistValue in a SuiteScript client script?
What error might be encountered if the sublist is not editable when using getCurrentSublistValue?
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.
