ANS-0358 · SUITESCRIPT DEVELOPMENT

How to Access Kit/Package Item Members in NetSuite SuiteScript 2.x

Learn to programmatically retrieve individual components of a kit or package item using SuiteScript 2.x APIs.

Short answer

To access individual items within a NetSuite kit or package, use the 'member' sublist internal ID. With SuiteScript 2.x, developers can retrieve the count of member items and their specific field values by utilizing record.getLineCount and record.getSublistValue functions, ensuring proper 0-based indexing for sublist lines.

Scenario

NetSuite users or developers often need to programmatically inspect the individual components that make up a kit or package item. This is essential for custom reporting, integrations, or business logic that requires detailed information about the constituent items rather than just the kit header.

Solution

The sublist internal ID for accessing the individual items within a kit or package is 'member'.To retrieve these items using SuiteScript, it is recommended to use SuiteScript 2.x APIs, which offer enhanced performance and are the current standard for NetSuite development.

  1. Get the count of member items

    Use the record.getLineCount function, specifying the sublist ID 'member'.

javascriptvar memberCount = record.getLineCount({ sublistId: 'member' });
  1. Access individual member item values

    Use the record.getSublistValue function. Remember that SuiteScript 2.x uses 0-based indexing for sublist lines. For example, to get the 'item' field value of the first member item:

javascriptvar firstMemberItem = record.getSublistValue({ sublistId: 'member', fieldId: 'item', line: 0 });

These functions enable developers to iterate through all member items and extract necessary details for custom logic or data processing.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant