ANS-1040 · SUITESCRIPT DEVELOPMENT
How to Programmatically Access Custom List Records in NetSuite SuiteScript 2.x
This guide explains the method for loading and retrieving values from custom list records within SuiteScript 2.x, enabling dynamic data access.
Short answer
To access a custom list record in SuiteScript 2.x, use record.load with the custom list's script ID and its internal ID. Once loaded, you can retrieve specific field values such as isinactive, value, value_fr_fr, abbreviation, and valueid to utilize the list item's data within your script logic.
Scenario
NetSuite developers often need to programmatically retrieve data from custom list records to support various business processes or custom functionalities. Understanding how to load these records and access their specific field values is crucial for building robust SuiteScript solutions that interact with custom list data.
Solution
To access a custom list record within a SuiteScript 2.x script, utilize the record.load function. This function requires the custom list's script ID as the type parameter and the internal ID of the specific list item you wish to load.
The general syntax for loading a custom list item is:n
javascriptnvar customListItem = record.load({n type: 'customlist_YOUR_SCRIPT_ID',n id: internalidn});nOnce the custom list item record is loaded, you can access its various field values. Common fields available for custom list items include:n* abbreviationn* isinactiven* valuen* value_fr_fr (or any other translation field, e.g., value_es_es)n* valueid (This represents the internal ID of the list item itself)
For example, to retrieve the value of a loaded custom list item:n
javascriptnvar itemValue = customListItem.getValue({n fieldId: 'value'n});nExpert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
