SuiteScript getCurrentSublistValue Method Reference
The SuiteScript getCurrentSublistValue method retrieves values from sublist fields, enhancing script functionality in records.
The getCurrentSublistValue method in SuiteScript allows scripts to retrieve the value of a specified sublist field from the currently selected line in a sublist. This is crucial in dynamic scripting, where UI behaviors replicate the current selection in NetSuite.
Method Description
The method is designed to return different data types based on the field being accessed. It can handle:
numberDatestringarrayboolean
Supported Script Types
- Client scripts
- Server scripts
Governance
- None
Module
N/recordModule
Parameters
The following table outlines the required parameters when using the method:
| Parameter | Type | Required/Optional | Description |
|---|---|---|---|
options.sublistId | string | Required | The internal ID of the sublist, viewable in the Records Browser. |
options.fieldId | string | Required | The internal ID of a standard or custom sublist field. |
Errors
Common error codes associated with getCurrentSublistValue include:
SSS_INVALID_SUBLIST_OPERATION: Thrown if a required argument is invalid or if the sublist is not editable.SSS_MISSING_REQD_ARGUMENT: Thrown if a required argument is missing or undefined.
Syntax
Here is the syntax for using the method, with a sample implementation:
1// Add additional code2...3var sublistValue = objRecord.getCurrentSublistValue({4 sublistId: 'item',5 fieldId: 'item'6});7...8// Add additional codeRelated Topics
- Record Object Members
- N/record Module
- SuiteScript 2.x Modules
Key Takeaways
- The
getCurrentSublistValuemethod is essential for retrieving sublist field values in SuiteScript. - It requires specific parameters, including
sublistIdandfieldId. - Proper use can enhance script efficiency and accuracy in dynamic mode implementations.
Frequently Asked Questions (4)
What script types support the use of the getCurrentSublistValue method in SuiteScript?
Do I need to worry about governance units when using the getCurrentSublistValue method?
What parameters are required when using the getCurrentSublistValue method?
What error might I encounter if the sublist is not set up correctly 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.
