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.
Source: This article is based on Oracle's official NetSuite documentation.
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 Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category