Split Shipment Fulfillment with NetSuite
Tags: fulfillment, netsuite, suitetalk • Categories: Software
Table of Contents
NetSuite natively supports partially fulfilling a SalesOrder. However, updating an ItemFulfillment record (NetSuite’s equivalent to a ‘package’ or ‘shipment’ in other systems nomenclature) after it’s been created comes with some unique edge cases in NetSuite.
Here’s the NetSuite state that I was operating in:
- Sales Order is created.
order_status = _partiallyFulfilled
- An ItemFulfillment exists with
ship_status = _picked
- A CustomerDeposit representing the payment coming from an external system is associated with the SalesOrder
- The contents of the created ItemFulfillment need to be adjusted and a second ItemFulfillment needs to be created.
Here is some key information on how NetSuite’s ItemFulfillments work:
- The
order_line
field is not set on an ItemFulfillments item list elements if the item is a “member” of another item in the item list. In other words, if you are fulfilling a KitItem or AssemblyItem the components of those items will appear on the ItemFulfillment’s item list but will not have a key (unique ID to reference them on the sub lisT) and thus cannot be updated. - The
item_receive
flag is equivalent to the “Fulfill” column in the GUI. - The
replace_all
flag onitem_list
must be set tofalse
when updating an item list containing KitItems or AssemblyItems. Also, all items without an order line must be removed from theitem_list
. If they are not removed, the following fatal error will be thrown: “Adding new line to sublist item is not allowed.”
Using the NetSuite SuiteTalk ruby gem, here’s how to remove items from an existing ItemFulfillment:
item_fulfillment.item_list.item.each do |i|
i.item_receive = false
i.quantity = 0
end
item_fulfillment.item_list.replace_all = false
item_fulfillment.item_list.items.reject! { |i| i.order_line.blank? }
item_fulfillment.update(item_list: item_fulfillment.item_list)