ANS-0120 · SAVED SEARCHES & FORMULAS
How to Search Item Fulfillment Lines with Missing Account Data in NetSuite?
Discover how to effectively query NetSuite Item Fulfillment records to retrieve line-level details, specifically when lines lack an an associated account, using SuiteScript 2.x search filters.
Short answer
To search NetSuite Item Fulfillment lines that do not have an associated account, create a SuiteScript 2.x search using the internal record type 'itemfulfillment'. Apply a filter ['account', 'anyof', '@NONE@'] to specifically target lines where the account field is empty or null, ensuring accurate retrieval of line-level data.
Scenario
Users often encounter challenges when trying to extract specific line-level information from NetSuite Item Fulfillment transactions. While standard search filters are typically effective for line-level data, a particular difficulty arises when attempting to identify or filter lines where certain fields, such as the associated account, are empty or null. This can prevent the retrieval of all necessary line details.
Solution
To accurately retrieve Item Fulfillment line details, especially when lines lack an associated account, a SuiteScript 2.x search must be configured with a specific filter. Although setting 'Main Line' to false is a standard approach for line-level data, the key to this particular scenario is to explicitly filter for lines where the 'account' field is empty. This is achieved by adding the filter ['account', 'anyof', '@NONE@'] to the search criteria. The NetSuite UI does not directly offer an option to select 'none' or 'empty' for this field, necessitating a programmatic solution. Below is an example of a SuiteScript 2.x search implementation:
javascript// Ensure the 'N/search' module is loaded in your SuiteScript 2.x environment.// Example: define(['N/search'], function(search) { ... });var columns = [];columns.push(search.createColumn({ name: 'internalid', sort: search.Sort.ASC }));columns.push(search.createColumn({ name: 'quantity' }));columns.push(search.createColumn({ name: 'itemid', join: 'item' }));columns.push(search.createColumn({ name: 'account' }));var filters = [ ["type", "anyof", "itemfulfillment"], "AND", ["account", "anyof", "@NONE@"]];var itemFulfillmentSearch = search.create({ type: "itemfulfillment", filters: filters, columns: columns});var searchResults = itemFulfillmentSearch.run().getRange({ start: 0, end: 1000 });// 'searchResults' will contain an array of search.Result objects.This script defines a search that targets the 'itemfulfillment' record type, includes essential line-level columns, and applies the crucial filter to identify lines without an assigned account.
Expert NetSuite Support
Need help with this NetSuite issue?
Saved Searches & Formulas consulting and configuration support
