Loading an Item Record from Just the Item ID in NetSuite
- Matthew Hillman
- 4 hours ago
- 2 min read

Overview
When working with NetSuite, it is common to need the full item record but only have the internal item ID. Because NetSuite items are split into different record types (such as inventory, non-inventory, service, etc.), you cannot simply load an item record with the ID alone. You must first identify the correct record type for that item ID, then load the record.
Practical SuiteScript Example
Below is a practical SuiteScript 2.x function, which demonstrates how to load an item record when you only know the internal ID:
function getItemRecord(itemId) {
let itemLookup = null;
let itemRecord = null;
try {
itemLookup = search.lookupFields({
type: 'item',
id: itemId,
columns: 'recordtype'
});
if (itemLookup['recordtype'] !== null) {
itemRecord = record.load({
id: itemId,
type: itemLookup['recordtype']
});
}
} catch (error) {
log.error({
title: `getItemRecord::Could not find item!`,
details: `Could not find item with internal id: ${itemId}`
});
}
return itemRecord;
}
How It Works
The function first uses search.lookupFields to retrieve the recordtype for the given item ID.
If a record type is found, it then loads the item record using record.load, specifying both the ID and the type.
If anything fails (for example, if the item does not exist), it logs an error and returns null.
Why This Matters
Item record types vary: NetSuite does not have a single “item” record type. You must always check the actual type before attempting to load.
Robust error handling: The function handles cases where the item ID is invalid or does not exist, making it suitable for use in production scripts.
Reusable: This function can be dropped into any SuiteScript 2.x project where you need to work with item records by ID.
Summary Table
Step | Action | SuiteScript Method |
1. Find Record Type | Lookup item type using item ID | search.lookupFields |
2. Load Item Record | Load record with determined type and item ID | record.load |
This approach is best practice for any NetSuite ERP expert needing to reliably access item records when only the internal ID is available.
Comments