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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- SuiteScript 2.x Sublist Values: Standard and Dynamic Mode
Use setSublistValue in standard mode; select a line, set its current value and commit it in dynamic mode. Choose the API from the record's mode.
- SuiteScript Record.setValue: Body Fields, Types and Errors
Set NetSuite body fields with Record.setValue, matching field IDs and value types and checking common API errors.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
