ANS-1058 · INVENTORY & ITEM MANAGEMENT

How to Retrieve Item Lead Time at the Transaction Line Level in NetSuite

Utilize SuiteScript 2.x search functionality to accurately capture item lead times per location on purchase order lines.

Short answer

To obtain item lead time at the transaction line level, create a SuiteScript 2.x search that filters for lines where the transaction line's location matches the item's inventory location. Use the 'locationleadtime' and 'inventorylocation' fields joined to the item record to retrieve accurate lead time data, bypassing the transaction's 'leadtime' field.

Scenario

Users often need to determine the specific lead time for each item on a transaction, such as a Purchase Order. The standard 'leadtime' field on the transaction itself may not reflect the item's lead time as defined per inventory location. A method is required to accurately retrieve the 'locationleadtime' associated with the item's designated 'inventorylocation' for each line.

Solution

To retrieve the lead time for each line of a Purchase Order, a SuiteScript 2.x search can be implemented. This search should identify lines where the transaction line's location corresponds to the item's 'inventorylocation' field.

The following SuiteScript 2.x example demonstrates how to construct the search filters and columns:

javascript
var filters = [];
filters.push(search.createFilter({name: "internalid", operator: search.Operator.IS, values: id}));
filters.push(search.createFilter({name: "mainline", operator: search.Operator.IS, values: false}));
filters.push(search.createFilter({name: "formulanumeric", operator: search.Operator.EQUAL_TO, values: 0, formula: "{item.inventorylocation.id} - {location.id}"}));

var columns = [];
columns.push(search.createColumn({name: 'locationleadtime', join: 'item'}));
columns.push(search.createColumn({name: 'inventorylocation', join: 'item'}));

This approach allows a script to accurately capture the lead time for each line of a Purchase Order. The key fields utilized are 'locationleadtime' and 'inventorylocation' when searching items. Data entered on the item master for lead times populates these fields, enabling the script to use this specific location-based lead time rather than the general 'leadtime' field found directly on the transaction.

Expert NetSuite Support

Need help with this NetSuite issue?

Inventory & Item Management consulting and configuration support

Talk to a consultant