ANS-1817 · SUITESCRIPT DEVELOPMENT
How to Retrieve Item Names from Item Receipt Records in NetSuite
This guide provides the SuiteScript 2.x method for programmatically accessing the item name from a specific line on an Item Receipt record.
Short answer
To retrieve an item's name from a specific line on an Item Receipt record using SuiteScript 2.x, utilize the record.getSublistText() method. Specify the sublist ID as 'item', the field ID as 'item', and the relevant line number to accurately fetch the desired item name.
Scenario
NetSuite users often need to programmatically access specific details from transaction records, such as the item name from an Item Receipt. This is particularly relevant when developing custom scripts that automate processes or validate data entry on sublist lines. The challenge lies in identifying the correct SuiteScript function and field ID to accurately extract this information.
Solution
To retrieve the item name from a specific line on an Item Receipt record using SuiteScript 2.x, employ the record.getSublistText() method. This function allows for the extraction of text values from sublist fields. The parameters required are the sublistId, which for items on an Item Receipt is 'item', the fieldId for the item name, which is also 'item' in SuiteScript 2.x, and the line number from which to retrieve the value. The following SuiteScript 2.x code snippet demonstrates how to achieve this:
javascriptvar itemName = record.getSublistText({sublistId: 'item',fieldId: 'item',line: lineNum});Replace record with your loaded record object and lineNum with the specific line index (0-based) from which you wish to retrieve the item name.
Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
