If you’ve ever tried automating Transfer Order fulfillments or receipts in NetSuite, whether through CSV import or SuiteScript transformations, you’ve likely faced a tricky challenge:
Which Line ID should I use?
This article walks through a pattern I’ve observed consistently across implementations, and why using the wrong key (like Item name/quantity) can break your automation.
In the past, I’ve worked with clients looking to automate their shipping and receiving processes. While it seems straightforward with Purchase Orders and Sales Orders, Transfer Orders behave differently when automation is applied, mainly due to the way the Line ID is handled.
A Line ID is a unique identifier assigned to each line item in a transaction (ie: sales order, purchase order, or transfer order). This ID remains constant and never changes, even if the sequence or order of the lines is modified.
For Sales Orders or Purchase Orders, the Line ID is typically the most reliable reference. When these transactions are transformed into Item Fulfillments or Item Receipts, the Line ID remains consistent and can be found in a hidden field called orderline.
In this case, if you're automating via SuiteScript or CSV, you can reliably use the Line ID from the originating order to determine which line(s) to process.
Fulfilling a Sales Order via SuiteScript
Here's an example of how you would go about fulfilling a Sales Order using SuiteScript:
// Sample data for the lines to process (items to fulfill)
const data = [
{ line: "4", quantity: 10 }, // Sales Order Line ID 4
];
// Transform Sales Order to Item Fulfillment
const recordType = record.Type.SALES_ORDER;
const orderId = '1234';
const fulfillment = record.transform({
fromType: recordType,
fromId: orderId,
toType: record.Type.ITEM_FULFILLMENT
});
// Loop through each row of data to find and process the correct line in Item Fulfillment
data.forEach(({ line, quantity }) => {
// Find the line index in the Item Fulfillment by matching the orderline (line number)
const index = fulfillment.findSublistLineWithValue({
sublistId: 'item',
fieldId: 'orderline',
value: line
});
// Return early if the line was not found
if (index === -1) return;
// Mark the line as fulfilled (for Sales Orders)
fulfillment.setSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
line: index,
value: true
});
// Adjust the quantity to ship
fulfillment.setSublistValue({
sublistId: 'item',
fieldId: 'quantity',
line: index,
value: quantity // Specify the quantity to fulfill
});
});
Same Principle for Item Receipts
When transforming Purchase Orders into Item Receipts, the process remains consistent. The Line IDs from the Purchase Order are already present in the Item Receipt through the orderline field, ensuring the receipt is processed accurately.
When you transform a Transfer Order (TO) to a Fulfillment or Receipt, the Line IDs on the resulting records don’t match the original TO.
NetSuite processes it differently, and here’s the important detail:
✅ The pattern is consistent:
This isn’t documented anywhere official, and I’ve observed this consistently across multiple implementations. Here’s what that pattern looks like:
This pattern is critical to understand, especially if you're planning to automate Transfer Order Fulfillments or Receipts via: SuiteScript (record.transform) or CSV imports (version 2025.1)
In my earlier days, I made the mistake of using the Item/Qty as my lookup key when determining which line to fulfill or receive. That might work in simple scenarios, and it quickly breaks in the real world:
By understanding and applying this +1 / +2 pattern, your automations will correctly identify and process the right line items.
This behavior may not be documented in SuiteAnswers or other official resources, and it has remained consistently reliable in every environment I’ve worked with. If you're building automations for Transfer Orders, being aware of this pattern can save you hours of debugging.
Our team is driven by a passion for solving challenges and creating solutions that aren’t easy to find. We’d love to hear how you approach this—especially if you've encountered unique use-cases. If you're working on something similar or need assistance with this approach, happy to connect and innovate together.
With over a decade of hands-on experience in NetSuite development, Vanessa has worked with global NetSuite partners and end-users, specializing in implementation, integration, administration, and support. She has led and built teams of developers throughout her consulting career. In 2015, Vanessa co-founded CloudCompass Technologies, where she took on the role of Delivery Manager, overseeing managed services for NetSuite clients.