Get Current Sublist Value in SuiteScript 2.0
Retrieve values from a sublist field in SuiteScript 2.0 using the getCurrentSublistValue method. TL;DR Opening This article covers how to leverage the
TL;DR Opening
This article covers how to leverage the getCurrentSublistValue method in SuiteScript 2.0 to access values from sublist fields effectively. Understanding this method is vital for SuiteScript developers working with dynamic record management.
What is the getCurrentSublistValue Method?
The getCurrentSublistValue method allows you to return the value of a specified field on the currently selected line of a sublist in a record. This is particularly useful in client scripts where user interaction involves sublists, such as items in a sales order.
Method Description
The method returns a value that can be one of several types, including number, Date, string, array, or boolean.
Supported Script Types
- Client scripts
Governance
- None
Module
- N/currentRecord Module
Parameters
The method accepts an options object as a parameter, which contains the following properties:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
options.sublistId | string | Required | The internal ID of the sublist, displayed in the Records Browser. |
options.fieldId | string | Required | The internal ID of a standard or custom sublist field. |
Error Codes
When using this method, the following errors may occur:
- SSS_INVALID_SUBLIST_OPERATION: This error is thrown if a required argument is invalid or the sublist is not editable.
- SSS_MISSING_REQD_ARGUMENT: This indicates that a required argument is missing or undefined.
Code Sample
Here’s a syntax example of how to use the getCurrentSublistValue method:
1// Add additional code 2...3var sublistValue = objRecord.getCurrentSublistValue({4 sublistId: 'item',5 fieldId: 'item'6});7... 8// Add additional codeFor a complete script example, refer to the N/currentRecord Module Script Samples.
Related Topics
- currentRecord.CurrentRecord
- N/currentRecord Module
- SuiteScript 2.x Modules
Key Takeaways:
- The
getCurrentSublistValuemethod retrieves field values from active sublist lines. - It requires parameters specifying the
sublistIdandfieldId. - Common error codes include usage of invalid or missing arguments.
Frequently Asked Questions (4)
In which SuiteScript types can the getCurrentSublistValue method be used?
What parameters are required for using the getCurrentSublistValue method?
What types of values can the getCurrentSublistValue method return?
What error codes should I be aware of 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.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- 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.
