Search code examples
sortingtransactionsnetsuiteerpaccounting

In NetSuite, can I sort a transaction by item # or some other column field?


Is it possible to sort the lines in a transaction by item (or some other column field)? We often receive very large orders from our customers and the items are in a more or less random order. When we receive said items from our vendors, the items come in numerical order by part number. It's very difficult for our logistics to receive them when our purchase order is in random order but the items came numerically. Is there any way for me to sort the purchase order by item #?


Solution

  • Re-sorting transaction lines is possible but quite prone to breaking. Until Netsuite actually supports it my recommendation would be to not spend time trying to re-sort lines.

    About the only place it's safe to do that is on a Sales Order in the before Submit phase. Generally a sales order is the start of a whole chain of related transactions. Some of these relations are visible from fields and some are hidden. There is no api to re-sort the lines so the the way to get them sorted is to cache the lines in memory; clear the lines from the sales order; and then re-insert the lines in the desired order.

    You have to make sure you capture everything and that you account for future customizations in your code.

    So the alternative of supplying a sorted UI to aid fulfillments and receipts is much more reliable. Some of the ways I've done that include:

    • Adding a text area where people can paste a formatted list of skus/qtys received. A client script processes that and sets up the item receipt lines.
    • Creating a pop-up with the PO's items sorted as you like with whatever controls you need for efficient handling. The pop-up has a button for processing items when you are done with the receipt.
    • A field that lets you enter a sku (can have type ahead) that either brings you to the item you are receiving (selects the line) or provides a qty field as well so you just work at the top of the item list and enter and sku/qty/click process... until you have received the order
    • a similar thing but expecting a scanner to provide the sku so the process is gun/qty/click process