How to Close a NetSuite SalesOrder Using SuiteTalk

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).

  • robert cowper

    Hi Michael, I don’t know Netsuite but have been asked to integrate a download or SO’s to another system, fulfill them there and then update the SO in Netsuite to allow invoicing to proceed. Two posts I’ve seen from you already suggest you as a valuable guide. Could I ask tow questions? (i) Can I just close the SO lines as you’ve described to allow invoicing or does Netsuite always require an ItemFulfillment to proceed? (ii) Do you know if short shipments are possible – in which case I suppose one would need some corresponding ItemFulfillment record – or can we reset item_list? Finally, do you engage directly if we have more questions?

    • http://mikebian.co/ Michael Bianco

      Hello Robert! Thanks for reaching out. The best place for these sort of questions is the NetSuite Slack group. Would you mind joining the group here and reposting your question? http://opensuite-slackin.herokuapp.com/

      As far as a direct engagement, I’m @mike on the Slack channel. Ping me there and we can chat!