Marty Zigman Marty Zigman
Prolecto Labs Accelerator Templates

NetSuite Sales Order Ship Partial Status Rules

ERP NetSuite Technical



This article is relevant if you are working with NetSuite and you need to assess if a sales order has fully shipped when you are working with partial shipments.

Background

A client used the Spree Ecommerce platform as both a customer shopping system and order management platform before they adopted NetSuite for their back end ERP system.  Under their old model, they assumed they shipped all orders complete; thus they were not worried about partial shipments.

As we designed their NetSuite implementation, we helped the client understand the natural relationships between sales orders and multiple item fulfillments.  Thus, NetSuite accommodates partial shipments and thus easily can indicate a back order situation.  While the client’s policy was to avoid partial shipments, the reality is that they would take pre-orders.  This means that before an item was available for sale, they would promote these new items on their web site and accept orders with zero-stock items along with standard in-stock items.   Hence, in reality, they were producing partial shipments on the old platform by performing workarounds.

One sub project of the NetSuite implementation was to produce an integration to the Shopify ECommerce system.  We have produced many custom eCommerce integrations and readers may be interested in these related articles:

  1. Shopify to NetSuite Integration: Your Way!
  2. NetSuite Content Management Integration with ExpressionEngine and BrilliantRetail
  3. What to Look for When Switching Out Ecommerce Systems

Since the client’s Spree Ecommerce platform was heavily modified and was not configured to handle partial shipments, and they did not have the capacity to make changes in their web site, we came up with a way to communicate order tracking and shipping information about partials and ship complete.

NetSuite Sales Order Partial and Final Status Rules

To help solve the challenge, we came up with two item fulfillment shipment flags that we would pass to the Spree system so it would know if the order is finally complete and thus, from its perspective, fully shipped:

  1. isPartial:  the isPartial flag will indicate if the shipment information is partial to help the Spree logic know that this order requires special processing.
  2. isFinal: the isFinal flag will indicate that the transaction is the final shipment and thus Spree will not get any additional information.  If the shipment is final, then Spree effectively can act as it had before there were partials.

To calculate these rules, we had to look at two key values on a Sales Order to come up with logic about isPartial and isFinal:

  1. Header: we needed to look at the Sales Orders status flag
  2. Lines: we needed to look at the quantity ordered vs. quantity shipped

Table of NetSuite Sales Order Status and Flag Rules

The following table was used in our algorithm to supply the isPartial and isFinal flags:

Status StatusRef isPartial isFinal
Sales Order:Pending Approval SalesOrd:A False False
Sales Order:Pending Fulfillment SalesOrd:B True False
Sales Order:Cancelled SalesOrd:C False True
Sales Order:Partially Fulfilled SalesOrd:D True False
Sales Order:Pending Billing/Partially Fulfilled SalesOrd:E True False
Sales Order:Pending Billing SalesOrd:F False True
Sales Order:Billed SalesOrd:G False True
Sales Order:Closed SalesOrd:H True True

SuiteScript 2.0 Code to Determine isPartial or isFinal Shipment Rules

The following code is used to evaluate a sales order’s header and line to return the isPartial and isFinal flag.  Notice that we compare the line item quantity ordered against the quantity fulfilled.

function isFinal(soRec) {
    return ["C","F","G","H"].indexOf(soRec.getValue('orderstatus')) != -1;
}

function isPartial(soRec) {
    var soStatus = ["B","D","E","H"].indexOf(soRec.getValue('orderstatus')) != -1;
    log.debug('isPartial', 'soStatus:=' + soStatus);

    // now lookup so items / only inventory items will be evaluated
    var soStatusItem = false;
    var lineCount = soRec.getLineCount({sublistId: "item"});
    for (var itemIdx = 0; itemIdx < lineCount; itemIdx++) {
        var qty = soRec.getSublistValue({sublistId: "item", fieldId : 'quantity', line: itemIdx});
        var qtyfulfilled = soRec.getSublistValue({sublistId: "item", fieldId : 'quantityfulfilled', line: itemIdx});
        log.debug('isPartial', 'soStatusItem(qty, qtyfulfilled):=(' + qty + ',' + qtyfulfilled + ')');

        if (qty != qtyfulfilled) {
            soStatusItem = true;
            break;
        }
    }
    return soStatusItem && soStatus;
}

Drive NetSuite Systems Integration Your Way

The above logic representation illustrates just a small sample of the constructs we produce for our clients.  In my mind, the power of the NetSuite platform is to leverage its inherent robust nature and transactional elements.  At the same time, NetSuite can be adapted to fit situations.  In this case, it was easier for us to adapt NetSuite to produce what the client needed versus modifying the front end eCommerce system.  If you are looking to produce a NetSuite integration and you want the rules to work your way, then let’s have a conversation.

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *