Skip to content

How to Close a NetSuite SalesOrder Using SuiteTalk

Tags: netsuite, suitetalk • Categories: Web Development

Table of Contents

Many things in NetSuite’s SuiteTalk XML API are not intuitive or obvious: closing a SalesOrder is one of them.

When you create a SalesOrder using upsert or add you can set the order_status to _pendingFulfillment or _pendingApproval directly through the order_status field. However, you can’t simply update the order_status field on a SalesOrder to close the record, you need to set is_closed field on each line item in the SalesOrder.

ns_order.item_list.items do |item|
  item.is_closed = true
end

ns_order.update({ item_list: ns_order.item_list })

Other SalesOrder states work in a similar way: _partiallyFulfilled, _fulfilled, etc are only achieved by modified the item_list sublist or by creating a separate record (ItemFulfillment, Invoice, etc).

Keep in Touch

Subscribe to my email list to keep in touch. I’ll send you new blog posts and other thoughts.