Over time, unused inventory items can accumulate due to discontinued products, testing, customer-specific requests, or changing business requirements. While these items remain active, they can clutter your item master and make inventory management more challenging. Identifying inventory items that have never appeared on a Sales Order helps support inventory cleanup, improve data quality, and simplify ongoing item maintenance.
SuiteQL Query
The query below returns the active inventory items that have never appeared on a Sales Order.
SELECT
i.id,
i.itemid,
i.displayname
FROM
item i
WHERE
-- Only include active inventory items.
i.isinactive = 'F'
AND i.itemtype = 'InvtPart'
-- Return only items that have never appeared on a Sales Order.
AND NOT EXISTS (
-- SELECT 1 is conventional.
-- NOT EXISTS only checks whether the subquery returns any rows.
SELECT 1
FROM
transaction t
INNER JOIN transactionLine tl
ON tl.transaction = t.id
WHERE
-- Correlate the transaction line to the current item.
tl.item = i.id
-- Only consider Sales Orders.
AND t.type = 'SalesOrd'
-- Ignore voided transactions.
AND t.voided = 'F'
-- Exclude the mainline record and only evaluate item lines.
AND tl.mainline = 'F'
)
ORDER BY
i.itemid;
To easily execute a SuiteQL query, see NetSuite Admin Tip | Running SUITEQL Using a Suitelet
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
We’d love to hear how you integrate SuiteQL into your NetSuite processes! Share your insights and experiences in the NetSuite Admin Corner.