Multiple Shipping Routes in SOAP Web Services

The following topics are covered in this section. If you are unfamiliar with the Multiple Shipping Routes feature, you should read these topics in order.

Multiple Shipping Routes Feature

The Multiple Shipping Routes (MSR) feature lets you associate several items with one transaction, and then set different shipping addresses and shipping methods for each item. Transaction types such as sales order, cash sale, invoice, estimate, and item fulfillment all support MSR.

When MSR is enabled in your account, and the Enable Item Line Shipping check box is selected on the transaction, each item can have its own shipping address and shipping method. The shipping address is specified in the Ship To column. The shipping method is specified in the Ship Via column.

In the UI, after all items have been added to the transaction, you must then create individual shipping groups by clicking the Calculate Shipping button on the Shipping tab. A shipping group includes all item details related to where the item is being shipped from, where it is being shipped to, the item's shipping method, and its shipping rate.

Although there is no UI label called “Shipping Group,” SOAP web services developers can verify that shipping groups have been created by doing a get on the transaction after it has been submitted.

Note:

For additional information on this feature, as well as steps for enabling MSR in your account, see Multiple Shipping Routes in the NetSuite Help Center.

How MSR Works in SOAP Web Services

Generally speaking, NetSuite SOAP web services attempts to programmatically mirror the actions a user takes in the UI. However, when working with MSR-enabled transactions in SOAP web services, developers should be aware of the following UI vs. SOAP web services distinctions:

Fields and Elements Associated with MSR

The following table lists UI field labels and their corresponding SOAP web services elements for all MSR-related fields.

UI Label

Element Name

Note

Enable Item Line Shipping

isMultishipTo

Set to true to allow for multiple items with separate shipping address/methods

Ship To

shipAddress

References the internal ID of the customer's shipping address. You can get the internal ID by clicking the Address tab on the customer's record. The address ID appears in the ID column.

Note:

The Show Internal ID preference must be enabled for address IDs to show.

Ship Via

shipMethod

References the internal ID of the item. Go to the Items list to see all item IDs.

Note:

The Show Internal ID preference must be enabled for address IDs to show.

There is no UI label for Shipping Group.

shipGroup

Each item that has a separate shipping address/shipping method will have a unique shipGroup number.

When you initialize a sales order to create a fulfillment, and the sales order has MSR enabled, you will need to specify a shipGroup value (1, 2, 3, etc) for each shipping group you want fulfilled. See figure.

Important:

If no shipGroup value is specified, only the item associated with the first shipGroup ( 1 ) will be fulfilled.

This figure shows two different shipping groups: shipGroup 1 and shipGroup 2. When initializing the transaction, you must specify each item you want fulfilled based on its shipGroup value.

MSR on Custom Forms

MSR does work on custom forms. However, after you enable Multiple Shipping Routes in your account, you must also enable MSR on your custom form by adding the Enable Line Item Shipping checkbox to the Items sublist. For steps on adding this checkbox to a custom form, see Multiple Shipping Routes in the NetSuite Help Center.

Note:

After MSR is enabled in your account, the Enable Line Item Shipping check box is automatically added to the Items sublist on standard forms.

Multiple Shipping Routes Code Samples for SOAP Web Services

The following samples provide a general workflow for SOAP web services developers using MSR. These samples use sales order as the transaction type.

In this workflow you can:

  1. Create a sales order and set your items

  2. Get the sales order

  3. Update the sales order items with MSR shipping information

  4. Retrieve the updated shipGroup data and update the shipping cost

  5. Update the sales order shipping group

  6. Initialize the sales order to create the item fulfillment

  7. Search for unfulfilled sales orders that are MSR-enabled

Create a sales order and set your items

This sample shows how to create a sales order and add items. Even if MSR is enabled in your NetSuite account, as this sample shows, you can continue to create sales orders that do not have MSR set for each items. MSR only becomes enabled on a transaction after isMultiShipTo is set to true.

Note:

See the sample Update the sales order items with MSR shipping information for details on converting a non-MSR transaction to an MSR-enabled transaction.

C#

          // First, initiate login
NetSuiteService nss = new NetSuiteService();

// provide login details....
// Create a sales order
SalesOrder so = new SalesOrder();         

RecordRef customer = new RecordRef();
customer.internalId = "123";
so.entity = customer;

// Set the order status on the sales order
so.orderStatus = SalesOrderOrderStatus._pendingFulfillment;
so.orderStatusSpecified = true;

// Add items
SalesOrderItem [] items = new SalesOrderItem[2];
SalesOrderItemList itemList = new SalesOrderItemList();

SalesOrderItem item1 = new SalesOrderItem();
RecordRef item1Ref = new RecordRef();
item1Ref.internalId = "40";
item1.item = item1Ref;
item1.amountSpecified = true;
item1.amount = 3.0;

SalesOrderItem item2 = new SalesOrderItem();
RecordRef itemRef2 = new RecordRef();
itemRef2.internalId = "45";
item2.item = itemRef2;
item2.quantitySpecified = true;
item2.quantity = 2;

items[0] = item1;
items[1] = item2;

itemList.item = items;
so.itemList = itemList;

WriteResponse ws = nss.add(so); 

        

SOAP Request

                      <record xmlns:q1="urn:sales_2017_1.transactions.webservices.netsuite.com" xsi:type="q1:SalesOrder">
               <q1:entity internalId="123" />
          <q1:orderStatus>_pendingFulfillment</q1:orderStatus>
               <q1:itemList>
                  <q1:item>
                     <q1:item internalId="40" />
                     <q1:amount>3</q1:amount>
                  </q1:item>
                  <q1:item>
                     <q1:item internalId="45" />
                     <q1:quantity>2</q1:quantity>
                  </q1:item>
               </q1:itemList>
            </record> 

        

SOAP Response

          <writeResponse>
  <platformCore:status isSuccess="true"
   xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
       <baseRef internalId="993" type="salesOrder" xsi:type="platformCore:RecordRef"
      xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
</writeResponse> 

        

Get the sales order

After adding items to a sales order, you can then get the sales order and enable MSR on the specific transaction. Note, you could have enabled MSR on the transaction when you originally created the sales order object. To do so, you needed to set isMultiShipTo to true in the first sample.

C#

          RecordRef rr = new RecordRef();
rr = (RecordRef) ws.baseRef;
String sKey = rr.internalId;
ReadResponse getResp = nss.get(rr); 

        

SOAP Request

                    <get xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
               <baseRef xmlns:q1="urn:core_2017_1.platform.webservices.netsuite.com" xsi:type="q1:RecordRef"
      internalId="993" type="salesOrder" />
          </get> 

        

SOAP Response

                            <record internalId="993" xsi:type="tranSales:SalesOrder"
         xmlns:tranSales="urn:sales_2017_1.transactions.webservices.netsuite.com">
                     <tranSales:createdDate>2008-09-15T17:29:00.000-07:00</tranSales:createdDate>
                     <tranSales:entity internalId="123"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>Carrie Davis</platformCore:name>
                     </tranSales:entity>
                     <tranSales:tranDate>2008-09-15T00:00:00.000-07:00</tranSales:tranDate>
                     <tranSales:tranId>183</tranSales:tranId>
                     <tranSales:source>web services</tranSales:source>
                     <tranSales:orderStatus>_pendingFulfillment</tranSales:orderStatus>
                     <tranSales:salesRep internalId="111"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>Corporate Sales Team</platformCore:name>
                     </tranSales:salesRep>
                     <tranSales:partner internalId="129"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>The Bay Times</platformCore:name>
                     </tranSales:partner>
                     <tranSales:leadSource internalId="100002"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>New Registration Promotion</platformCore:name>
                     </tranSales:leadSource>
                     <tranSales:salesEffectiveDate>2008-09-15T00:00:00.000-07:00</tranSales:salesEffectiveDate>
                     <tranSales:excludeCommission>false</tranSales:excludeCommission>
                     <tranSales:promoCode internalId="2"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>New Registration Promotion</platformCore:name>
                     </tranSales:promoCode>
                     <tranSales:toBePrinted>false</tranSales:toBePrinted>
                     <tranSales:toBeEmailed>false</tranSales:toBeEmailed>
                     <tranSales:email>carrie10101@freeversion.1org</tranSales:email>
                     <tranSales:toBeFaxed>false</tranSales:toBeFaxed>
                     <tranSales:transactionBillAddress
         xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
                        <platformCommon:billAddr1>550504  Mission Street</platformCommon:billAddr1>
                        <platformCommon:billCity>Santa Cruz</platformCommon:billCity>
                        <platformCommon:billState>CA</platformCommon:billState>
                        <platformCommon:billZip>95060</platformCommon:billZip>
                        <platformCommon:billCountry>_unitedStates</platformCommon:billCountry>
                     </tranSales:transactionBillAddress>
                     <tranSales:billAddress>550504  Mission Street<br>Santa Cruz CA 95060<br>United
         States</tranSales:billAddress>
                     <tranSales:transactionShipAddress
         xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
                        <platformCommon:shipAddr1>550504  Mission Street</platformCommon:shipAddr1>
                        <platformCommon:shipCity>Santa Cruz</platformCommon:shipCity>
                        <platformCommon:shipState>CA</platformCommon:shipState>
                        <platformCommon:shipZip>95060</platformCommon:shipZip>
                        <platformCommon:shipCountry>_unitedStates</platformCommon:shipCountry>
                        <platformCommon:shipIsResidential>true</platformCommon:shipIsResidential>
                     </tranSales:transactionShipAddress>
                     <tranSales:shipAddress>550504  Mission Street<br>Santa Cruz CA 95060<br>United
         States</tranSales:shipAddress>
                     <tranSales:shipDate>2008-0911a4-15T00:00:00.000-07:00</tranSales:shipDate>
                     <tranSales:shipMethod internalId="3"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>Special Delivery</platformCore:name>
                     </tranSales:shipMethod>
                     <tranSales:shippingCost>5.0</tranSales:shippingCost>
                     <tranSales:isMultiShipTo>false</tranSales:isMultiShipTo>
                     <tranSales:shippingTaxCode internalId="-7"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>-Not Taxable-</platformCore:name>
                     </tranSales:shippingTaxCode>
                     <tranSales:handlingTaxCode internalId="-7"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>-Not Taxable-</platformCore:name>
                     </tranSales:handlingTaxCode>
                     <tranSales:handlingCost>6.0</tranSales:handlingCost>
                     <tranSales:shipComplete>false</tranSales:shipComplete>
                     <tranSales:ccApproved>false</tranSales:ccApproved>
                     <tranSales:altSalesTotal>0.0</tranSales:altSalesTotal>
                     <tranSales:subTotal>24.9</tranSales:subTotal>
                     <tranSales:altShippingCost>5.0</tranSales:altShippingCost>
                     <tranSales:altHandlingCost>6.0</tranSales:altHandlingCost>
                     <tranSales:total>35.9</tranSales:total>
                     <tranSales:subsidiary internalId="1"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:name>Parent Company</platformCore:name>
                     </tranSales:subsidiary>
                     <tranSales:lastModifiedDate>2008-09-15T17:29:00.000-07:00</tranSales:lastModifiedDate>
                     <tranSales:status>Pending Fulfillment</tranSales:status>
                     <tranSales:itemList>
                        <tranSales:item>
                           <tranSales:item internalId="40"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Accessories : Crusher Game Pad</platformCore:name>
                           </tranSales:item>
                           <tranSales:quantity>1.0</tranSales:quantity>
                           <tranSales:description>Crusher Game Pad</tranSales:description>
                           <tranSales:price internalId="1"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Base Price</platformCore:name>
                           </tranSales:price>
                           <tranSales:rate>12.95</tranSales:rate>
                           <tranSales:amount>3.0</tranSales:amount>
                           <tranSales:commitInventory>_availableQty</tranSales:commitInventory>
                           <tranSales:isClosed>false</tranSales:isClosed>
                           <tranSales:fromJob>false</tranSales:fromJob>
                           <tranSales:isEstimate>false</tranSales:isEstimate>
                           <tranSales:line>1</tranSales:line>
                           <tranSales:quantityBackOrdered>0.0</tranSales:quantityBackOrdered>
                           <tranSales:quantityBilled>0.0</tranSales:quantityBilled>
                           <tranSales:quantityCommitted>1.0</tranSales:quantityCommitted>
                           <tranSales:quantityFulfilled>0.0</tranSales:quantityFulfilled>
                           <tranSales:taxCode internalId="-7"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>-Not Taxable-</platformCore:name>
                           </tranSales:taxCode>
                        </tranSales:item>
                        <tranSales:item>
                           <tranSales:item internalId="45"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Accessories : Cable - Cat 5, 10 ft</platformCore:name>
                           </tranSales:item>
                           <tranSales:quantity>2.0</tranSales:quantity>
                           <tranSales:description>Cat 5 Patch Cable 10 ft</tranSales:description>
                           <tranSales:price internalId="1"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Base Price</platformCore:name>
                           </tranSales:price>
                           <tranSales:rate>10.95</tranSales:rate>
                           <tranSales:amount>21.9</tranSales:amount>
                           <tranSales:commitInventory>_availableQty</tranSales:commitInventory>
                           <tranSales:isClosed>false</tranSales:isClosed>
                           <tranSales:fromJob>false</tranSales:fromJob>
                           <tranSales:isEstimate>false</tranSales:isEstimate>
                           <tranSales:line>2</tranSales:line>
                           <tranSales:quantityBackOrdered>0.0</tranSales:quantityBackOrdered>
                           <tranSales:quantityBilled>0.0</tranSales:quantityBilled>
                           <tranSales:quantityCommitted>2.0</tranSales:quantityCommitted>
                           <tranSales:quantityFulfilled>0.0</tranSales:quantityFulfilled>
                           <tranSales:taxCode internalId="-7"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>-Not Taxable-</platformCore:name>
                           </tranSales:taxCode>
                        </tranSales:item>
                     </tranSales:itemList>
                  <tranSales:customFieldList
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                        <platformCore:customField internalId="215" scriptId="custbody1"
         xsi:type="platformCore:StringCustomFieldRef">
                           <platformCore:value>800-555-9177</platformCore:value>
                        </platformCore:customField>
                     </tranSales:customFieldList>
                  </record> 

        

Update the sales order items with MSR shipping information

This sample shows how to convert a sales order that does not yet have MSR enabled to a sales order that does. To do this you must set isMulitShipTo to true and then specify the shipAddress and shipMethod for each item.

C#

          // Keep a record of the sales order from previous query operation
SalesOrder soCreated = (SalesOrder) getResp.record;
SalesOrder soUpdate = new SalesOrder();
soUpdate.internalId = soCreated.internalId;

// Enable line level shipping. This is equivalent to selecting
// the Enable Line Level Shipping checkbox on the Items tab.
soUpdate.isMultiShipToSpecified = true;
soUpdate.isMultiShipTo = true;
// set shipMethods and shipAddresses
SalesOrderItem [] itemsUpdate = new SalesOrderItem[soCreated.itemList.item.Length];
SalesOrderItem item1Update = new SalesOrderItem();
item1Update.lineSpecified=true;
item1Update.line = soCreated.itemList.item[0].line;
RecordRef shipAddr1 = new RecordRef();
shipAddr1.internalId = "93";
item1Update.shipAddress = shipAddr1;

RecordRef shipMeth1 = new RecordRef();
shipMeth1.internalId = "2";
item1Update.shipMethod = shipMeth1;
SalesOrderItem item2Update = new SalesOrderItem();
item2Update.lineSpecified=true;
item2Update.line = soCreated.itemList.item[1].line;
RecordRef shipAddr2 = new RecordRef();
shipAddr2.internalId = "244715";
item2Update.shipAddress = shipAddr2;
RecordRef shipMeth2 = new RecordRef();
shipMeth2.internalId = "92";
item2Update.shipMethod = shipMeth2;
itemsUpdate[0] = item1Update;
itemsUpdate[1] = item2Update;
SalesOrderItemList itemListUpdate = new SalesOrderItemList();
itemListUpdate.item = itemsUpdate;
soUpdate.itemList = itemListUpdate;
nss.update(soUpdate); 

        

SOAP Request

                         <update xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
                  <record xmlns:q1="urn:sales_2017_1.transactions.webservices.netsuite.com"
         xsi:type="q1:SalesOrder" internalId="997">
                     <q1:isMultiShipTo>true</q1:isMultiShipTo>
                     <q1:itemList>
                        <q1:item>
                           <q1:line>1</q1:line>
                           <q1:shipAddress internalId="93" />
                           <q1:shipMethod internalId="2" />
                        </q1:item>
                        <q1:item>
                           <q1:line>2</q1:line>
                           <q1:shipAddress internalId="244715" />
                           <q1:shipMethod internalId="92" />
                        </q1:item>
                     </q1:itemList>
                  </record>
               </update> 

        

SOAP Response

          <writeResponse>
  <platformCore:status isSuccess="true"
   xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                     <baseRef internalId="997" type="salesOrder" xsi:type="platformCore:RecordRef"
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
</writeResponse> 

        

Retrieve the updated shipGroup data and update the shipping cost

If you choose, you can get the sales order and then specify which item you want to update based on the item's shipGroup value.

C#

          // Retrieve the updated shipGroup data and then update
// the shipping cost
ReadResponse getRespUpdated = nss.get(rr); 

        

SOAP Request

          <get xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
   <baseRef xmlns:q1="urn:core_2017_1.platform.webservices.netsuite.com" xsi:type="q1:RecordRef"
   internalId="997" type="salesOrder" />
</get> 

        

SOAP Response

          <record internalId="997" xsi:type="tranSales:SalesOrder"
   xmlns:tranSales="urn:sales_2017_1.transactions.webservices.netsuite.com">
               <tranSales:createdDate>2008-09-16T10:51:00.000-07:00</tranSales:createdDate>
              <tranSales:entity internalId="123"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Carrie Davis</platformCore:name>
                           </tranSales:entity>
                           <tranSales:tranDate>2008-09-16T00:00:00.000-07:00</tranSales:tranDate>
                           <tranSales:tranId>186</tranSales:tranId>
                           <tranSales:source>web services</tranSales:source>
                           <tranSales:orderStatus>_pendingFulfillment</tranSales:orderStatus>
                           <tranSales:salesRep internalId="111"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Corporate Sales Team</platformCore:name>
                           </tranSales:salesRep>
                           <tranSales:partner internalId="129"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>The Bay Times</platformCore:name>
                           </tranSales:partner>
                           <tranSales:leadSource internalId="100002"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>New Registration Promotion</platformCore:name>
                           </tranSales:leadSource>
                           <tranSales:salesEffectiveDate>2008-09-16T00:00:00.000-07:00</tranSales:salesEffectiveDate>
                           <tranSales:excludeCommission>false</tranSales:excludeCommission>
                           <tranSales:promoCode internalId="2"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>New Registration Promotion</platformCore:name>
                           </tranSales:promoCode>
                           <tranSales:toBePrinted>false</tranSales:toBePrinted>
                           <tranSales:toBeEmailed>false</tranSales:toBeEmailed>
                           <tranSales:email>carrie10101@freeversion.1org</tranSales:email>
                           <tranSales:toBeFaxed>false</tranSales:toBeFaxed>
                           <tranSales:transactionBillAddress
            xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
                              <platformCommon:billAddr1>550504  Mission Street</platformCommon:billAddr1>
                              <platformCommon:billCity>Santa Cruz</platformCommon:billCity>
                              <platformCommon:billState>CA</platformCommon:billState>
                              <platformCommon:billZip>95060</platformCommon:billZip>
                              <platformCommon:billCountry>_unitedStates</platformCommon:billCountry>
                           </tranSales:transactionBillAddress>
                           <tranSales:billAddress>550504  Mission Street<br>Santa Cruz CA 95060<br>United
            States</tranSales:billAddress>
                           <tranSales:transactionShipAddress
            xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
                              <platformCommon:shipIsResidential>false</platformCommon:shipIsResidential>
                           </tranSales:transactionShipAddress>
                           <tranSales:shipDate>2008-09-16T00:00:00.000-07:00</tranSales:shipDate>
                           <tranSales:isMultiShipTo>true</tranSales:isMultiShipTo>
                           <tranSales:shipComplete>false</tranSales:shipComplete>
                           <tranSales:ccApproved>false</tranSales:ccApproved>
                           <tranSales:altSalesTotal>0.0</tranSales:altSalesTotal>
                           <tranSales:subTotal>24.9</tranSales:subTotal>
                           <tranSales:altShippingCost>11.87</tranSales:altShippingCost>
                           <tranSales:altHandlingCost>4.0</tranSales:altHandlingCost>
                           <tranSal11a4es:total>40.77</tranSales:total>
                           <tranSales:subsidiary internalId="1"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:name>Parent Company</platformCore:name>
                           </tranSales:subsidiary>
                           <tranSales:lastModifiedDate>2008-09-16T10:51:00.000-07:00</tranSales:lastModifiedDate>
                           <tranSales:status>Pending Fulfillment</tranSales:status>
                           <tranSales:itemList>
                              <tranSales:item>
                                 <tranSales:item internalId="40"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Accessories : Crusher Game Pad</platformCore:name>
                                 </tranSales:item>
                                 <tranSales:quantity>1.0</tranSales:quantity>
                                 <tranSales:description>Crusher Game Pad</tranSales:description>
                                 <tranSales:price internalId="1"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Base Price</platformCore:name>
                                 </tranSales:price>
                                 <tranSales:rate>12.95</tranSales:rate>
                                 <tranSales:amount>3.0</tranSales:amount>
                                 <tranSales:commitInventory>_availableQty</tranSales:commitInventory>
                                 <tranSales:isClosed>false</tranSales:isClosed>
                                 <tranSales:fromJob>false</tranSales:fromJob>
                                 <tranSales:isEstimate>false</tranSales:isEstimate>
                                 <tranSales:line>1</tranSales:line>
                                 <tranSales:quantityBackOrdered>0.0</tranSales:quantityBackOrdered>
                                 <tranSales:quantityBilled>0.0</tranSales:quantityBilled>
                                 <tranSales:quantityCommitted>1.0</tranSales:quantityCommitted>
                                 <tranSales:quantityFulfilled>0.0</tranSales:quantityFulfilled>
                                 <tranSales:taxCode internalId="-7"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>-Not Taxable-</platformCore:name>
                                 </tranSales:taxCode>
                                 <tranSales:shipAddress internalId="93"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Billing Address</platformCore:name>
                                 </tranSales:shipAddress>
                                 <tranSales:shipMethod internalId="2"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Pick-up</platformCore:name>
                                 </tranSales:shipMethod>
                              </tranSales:item>
                              <tranSales:item>
                                 <tranSales:item internalId="45"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Accessories : Cable - Cat 5, 10 ft</platformCore:name>
                                 </tranSales:item>
                                 <tranSales:quantity>2.0</tranSales:quantity>
                                 <tranSales:description>Cat 5 Patch Cable 10 ft</tranSales:description>
                                 <tranSales:price internalId="1"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Base Price</platformCore:name>
                                 </tranSales:price>
                                 <tranSales:rate>10.95</tranSales:rate>
                                 <tranSales:amount>21.9</tranSales:amount>
                                 <tranSales:commitInventory>_availableQty</tranSales:commitInventory>
                                 <tranSales:isClosed>false</tranSales:isClosed>
                                 <tranSales:fromJob>false</tranSales:fromJob>
                                 <tranSales:isEstimate>false</tranSales:isEstimate>
                                 <tranSales:line>2</tranSales:line>
                                 <tranSales:quantityBackOrdered>0.0</tranSales:quantityBackOrdered>
                                 <tranSales:quantityBilled>0.0</tranSales:quantityBilled>
                                 <tranSales:quantityCommitted>2.0</tranSales:quantityCommitted>
                                 <tranSales:quantityFulfilled>0.0</tranSales:quantityFulfilled>
                                 <tranSales:taxCode internalId="-7"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>-Not Taxable-</platformCore:name>
                                 </tranSales:taxCode>
                                 <tranSales:shipAddress internalId="244715"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>san mateo shipping</platformCore:name>
                                 </tranSales:shipAddress>
                                 <tranSales:shipMethod internalId="92"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>UPS Ground</platformCore:name>
                                 </tranSales:shipMethod>
                              </tranSales:item>
                           </tranSales:itemList>
                           <tranSales:shipGroupList>
                              <tranSales:shipGroup>
                                 <tranSales:id>1</tranSales:id>
                                 <tranSales:isFulfilled>false</tranSales:isFulfilled>
                                 <tranSales:weight>1.0</tranSales:weight>
                                 <tranSales:sourceAddressRef internalId="DEFAULT"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                                 <tranSales:sourceAddress>1500 3rd St San Mateo, CA 94403 US</tranSales:sourceAddress>
                                 <tranSales:destinationAddressRef internalId="93"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                                 <tranSales:destinationAddress>CO United States</tranSales:destinationAddress>
                                 <tranSales:shippingMethodRef internalId="2"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                                 <tranSales:shippingMethod>Pick-up</tranSales:shippingMethod>
                                 <tranSales:handlingRate>0.0</tranSales:handlingRate>
                                 <tranSales:shippingRate>5.0</tranSales:shippingRate>
                              </tranSales:shipGroup>
                              <tra50anSales:shipGroup>
                                 <tranSales:id>2</tranSales:id>
                                 <tranSales:isFulfilled>false</tranSales:isFulfilled>
                                 <tranSales:weight>2.0</tranSales:weight>
                                 <tranSales:sourceAddressRef internalId="DEFAULT"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                                 <tranSales:sourceAddress>1500 3rd St San Mateo, CA 94403 US</tranSales:sourceAddress>
                                 <tranSales:destinationAddressRef internalId="244715"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                                 <tranSales:destinationAddress>2955 Campus Drive 175 San Mateo CA 94403 United
            States</tranSales:destinationAddress>
                                 <tranSales:shippingMethodRef internalId="92"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                                 <tranSales:shippingMethod>UPS Ground</tranSales:shippingMethod>
                                 <tranSales:handlingRate>4.0</tranSales:handlingRate>
                                 <tranSales:shippingRate>6.87</tranSales:shippingRate>
                              </tranSales:shipGroup>
                           </tranSales:shipGroupList>
                           <tranSales:customFieldList
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                              <platformCore:customField internalId="215" scriptId="custbody1"
            xsi:type="platformCore:StringCustomFieldRef">
                                 <platformCore:value>800-555-9177</platformCore:value>
                              </platformCore:customField>
                           </tranSales:customFieldList>
                        </record> 

        

Update the sales order shipping group

By specifying a shipping group, you can then update the data associated with that shipping group. This data includes item shipping and handling rates.

C#

          // Update the sales order shipping groups, for example, the shipping rate

// Keep a record of the SO updated
SalesOrder soUpdated = (SalesOrder) getRespUpdated.record;
SalesOrder soShipGroupUpdate = new SalesOrder();
soShipGroupUpdate.internalId = soUpdated.internalId;

TransactionShipGroup shipGroup1 = new TransactionShipGroup();
shipGroup1.idSpecified = true;
shipGroup1.id = soUpdated.shipGroupList.shipGroup[0].id;
shipGroup1.shippingRateSpecified = true;
shipGroup1.shippingRate = 10.0;
TransactionShipGroup [] shipGroups = new TransactionShipGroup[1];
shipGroups[0] = shipGroup1;

SalesOrderShipGroupList shipGroupList = new SalesOrderShipGroupList();
shipGroupList.shipGroup = shipGroups;
soShipGroupUpdate.shipGroupList = shipGroupList;
nss.update(soShipGroupUpdate); 

        

SOAP Request

          <update xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
  <record xmlns:q1="urn:sales_2017_1.transactions.webservices.netsuite.com" xsi:type="q1:SalesOrder"
   internalId="997">
   <q1:shipGroupList>
      <q1:shipGroup>
         <q1:id>1</q1:id>
         <q1:shippingRate>10</q1:shippingRate>
     </q1:shipGroup>
 </q1:shipGroupList>
 </record>
</update> 

        

SOAP Response

          <writeResponse>
   <platformCore:status isSuccess="true"
   xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
          <baseRef internalId="997" type="salesOrder" xsi:type="platformCore:RecordRef"
        xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/> 

        

Initialize the sales order to create the item fulfillment

Next, you can run initialize() to obtain the item fulfillment record.

Note:

The initialize operation includes an optional argument called AuxReference. In AuxReference users can set the type to shippingGroup by using the enum object InitializeAuxRefType.

When working with MSR-enabled transactions, you must specify a value for shippingGroup. If you do not specify a value, the value 1 (for the first shipping group) is defaulted. This means that only the items belonging to the first shipping group will be fulfilled when the sales order is initialized.

C#

          for (int j=0; j<soUpdated.shipGroupList.shipGroup.Length; j++)
{
   InitializeRecord ir = new InitializeRecord();
   ir.type = InitializeType.itemFulfillment;
   InitializeRef iref = new InitializeRef();
   iref.typeSpecified=true;
   iref.type=InitializeRefType.salesOrder;
   iref.internalId = rr.internalId;
   ir.reference = iref;
   InitializeAuxRef iar = new InitializeAuxRef();
   iar.typeSpecified=true;
   iar.type = InitializeAuxRefType.shippingGroup;
   iar.internalId = soUpdated.shipGroupList.shipGroup[j].id.ToString();
   ir.auxReference = iar;
   ReadResponse getInitResp = nss.initialize(ir);
      if (getInitResp.status.isSuccess)
      {
      // Keep a record of the original item fulfillment
      ItemFulfillment ifrec = (ItemFulfillment) getInitResp.record;
      
      //SalesOrderShipGroupList sgListForIF = ifrec..shipGroupList;
      //TransactionShipGroup [] shipGroupsForIF = sgListForIF.shipGroup;

      ItemFulfillment recToFulfill = new ItemFulfillment();
      // Set createdFrom field
      recToFulfill.createdFrom = ifrec.createdFrom;
      // Set createdFromShipGroup field for multiple shipping routes enabled orders
      recToFulfill.createdFromShipGroupSpecified=true;
      recToFulfill.createdFromShipGroup = soUpdated.shipGroupList.shipGroup[j].id;
      ItemFulfillmentItemList ifitemlist = ifrec.itemList;
      ItemFulfillmentItem [] ifitems = new ItemFulfillmentItem[ifitemlist.item.Length];
      RecordRef locRef = new RecordRef();
      locRef.internalId = "1";
         for (int i=0; i<ifitemlist.item.Length; i++)
         {
         ItemFulfillmentItem ffItem = new ItemFulfillmentItem();
         ffItem.item = ifitemlist.item[i].item;
         ffItem.orderLineSpecified=true;
         ffItem.orderLine = ifitemlist.item[i].orderLine;                     
         ffItem.location = locRef;
         ifitems[i] = ffItem;
         }
         ItemFulfillmentItemList ifitemlistToFulfill = new ItemFulfillmentItemList();
         ifitemlistToFulfill.item = ifitems;
         recToFulfill.itemList = ifitemlistToFulfill;
         nss.add(recToFulfill);                  
         }
   } 

        

SOAP Request

                                  <initialize xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
                           <initializeRecord>
                              <type xmlns="urn:core_2017_1.platform.webservices.netsuite.com">itemFulfillment</type>
                              <reference type="salesOrder" internalId="997"
            xmlns="urn:core_2017_1.platform.webservices.netsuite.com" />
                              <auxReference type="shippingGroup" internalId="1"
            xmlns="urn:core_2017_1.platform.webservices.netsuite.com" />
                           </initializeRecord>
                        </initialize> 

        

SOAP Response

                                  <initializeResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
                           <readResponse>
                              <platformCore:status isSuccess="true"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                              <record xsi:type="tranSales:ItemFulfillment"
            xmlns:tranSales="urn:sales_2017_1.transactions.webservices.netsuite.com">
                                 <tranSales:createdDate>2008-09-16T10:51:00.000-07:00</tranSales:createdDate>
                                 <tranSales:lastModifiedDate>2008-09-16T10:51:00.000-07:00</tranSales:lastModifiedDate>
                                 <tranSales:postingPeriod internalId="132"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Sep 2008</platformCore:name>
                                 </tranSales:postingPeriod>
                                 <tranSales:entity internalId="123"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Carrie Davis</platformCore:name>
                                 </tranSales:entity>
                                 <tranSales:createdFrom internalId="997"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Sales Order #186</platformCore:name>
                                 </tranSales:createdFrom>
                                 <tranSales:transactionShipAddress
            xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
                                    <platformCommon:shipAttention>Billing Address</platformCommon:shipAttention>
                                    <platformCommon:shipAddressee>Carrie Davis</platformCommon:shipAddressee>
                                    <platformCommon:shipPhone>800-555-9177</platformCommon:shipPhone>
                                    <platformCommon:shipState>CO</platformCommon:shipState>
                                    <platformCommon:shipCountry>_unitedStates</platformCommon:shipCountry>
                                    <platformCommon:shipIsResidential>false</platformCommon:shipIsResidential>
                                 </tranSales:transactionShipAddress>
                                 <tranSales:shipAddressList internalId="93"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Billing Address</platformCore:name>
                                 </tranSales:shipAddressList>
                                 <tranSales:shipAddress>Carrie DavisCO US</tranSales:shipAddress>
                                 <tranSales:tranDate>2008-09-16T00:00:00.000-07:00</tranSales:tranDate>
                                 <tranSales:tranId>39</tranSales:tranId>
                                 <tranSales:shipMethod internalId="2"
            xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                    <platformCore:name>Pick-up</platformCore:name>
                                 </tranSales:shipMethod>
                                 <tranSales:shippingCost>10.0</tranSales:shippingCost>
                                 <tranSales:handlingCost>0.0</tranSales:handlingCost>
                                 <tranSales:itemList>
                                    <tranSales:item>
                                       <tranSales:itemReceive>true</tranSales:itemReceive>
                                       <tranSales:itemName>Crusher Game Pad </tranSales:itemName>
                                       <tranSales:description>Crusher Game Pad</tranSales:description>
                                       <tranSales:quantity>1.0</tranSales:quantity>
                                       <tranSales:item internalId="40"
               xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                                          <platformCore:name>Crusher Game Pad</platformCore:name>
                                       </tranSales:item>
                                       <tranSales:orderLine>1</tranSales:orderLine>
                                       <tranSales:quantityRemaining>1.0</tranSales:quantityRemaining>
                                    </tranSales:item>
                                 </tranSales:itemList>
                              </record>
                           </readResponse>
                        </initializeResponse> 

        

SOAP Request (Item Fulfillment)

                                     <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
                              <record xmlns:q1="urn:sales_2017_1.transactions.webservices.netsuite.com"
            xsi:type="q1:ItemFulfillment">
                                 <q1:createdFrom internalId="997">
                                    <name xmlns="urn:core_2017_1.platform.webservices.netsuite.com">Sales Order #186
               </name>
                                 </q1:createdFrom>
                                 <q1:itemList>
                                    <q1:item>
                                       <q1:location internalId="1" />
                                       <q1:item internalId="40">
                                          <name xmlns="urn:core_2017_1.platform.webservices.netsuite.com">Crusher Game
               Pad</name>
                                       </q1:item>
                                       <q1:orderLine>1</q1:orderLine>
                                    </q1:item>
                                 </q1:itemList>
                              </record>
                           </add> 

        

SOAP Response (Item Fulfillment)

          <writeResponse>
  <platformCore:status isSuccess="true"
    xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
   <baseRef internalId="998" type="itemFulfillment" xsi:type="platformCore:RecordRef"
   xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
</writeResponse> 

        

Search for unfulfilled sales orders that are MSR-enabled

This sample shows how to search for unfulfilled sales orders that are MSR-enabled. For details on how to specify additional search criteria, see Advanced Searches in SOAP Web Services.

C#

            // Define search criteria and return columns
 TransactionSearchAdvanced tsa4 = new TransactionSearchAdvanced();
 
// Set search preference to return search columns
SearchPreferences sp = new SearchPreferences();
sp.returnSearchColumns = true;
nss.searchPreferences = sp;
// Instantiate SearchRow object
TransactionSearchRow tsr = new TransactionSearchRow();
TransactionSearchRowBasic tsrb = new TransactionSearchRowBasic();
// return internId
SearchColumnSelectField [] orderIdCols = new SearchColumnSelectField[1];
SearchColumnSelectField orderIdCol = new SearchColumnSelectField();
orderIdCol.customLabel = "Sales Order ID"; // Define a custom label
orderIdCols[0] = orderIdCol;
tsrb.internalId = orderIdCols;
// return item
SearchColumnSelectField [] itemIdCols = new SearchColumnSelectField[1];
SearchColumnSelectField itemId = new SearchColumnSelectField();
itemIdCols[0] = itemId;
tsrb.item = itemIdCols;
// return item fulfillment status
SearchColumnBooleanField [] isFulfilledCols = new SearchColumnBooleanField[1];
SearchColumnBooleanField isFulfilledCol = new SearchColumnBooleanField();
isFulfilledCol.customLabel = "Order Fulfilled";
isFulfilledCols[0] = isFulfilledCol;
tsrb.shipRecvStatusLine = isFulfilledCols;
// return tranDate
SearchColumnDateField [] tranDateCols = new SearchColumnDateField[1];
SearchColumnDateField tranDateCol = new SearchColumnDateField();
tranDateCols[0] = tranDateCol;
tsrb.tranDate = tranDateCols;
// return tranId
SearchColumnStringField [] tranIdCols = new SearchColumnStringField[1];
SearchColumnStringField tranIdCol = new SearchColumnStringField();
tranIdCols[0] = tranIdCol;
tsrb.tranId = tranIdCols;

tsr.basic = tsrb;
// Define search criteria
TransactionSearch ts = new TransactionSearch();
TransactionSearchBasic tsb = new TransactionSearchBasic();
// on SO only
SearchEnumMultiSelectField semsfTranType = new SearchEnumMultiSelectField();
semsfTranType.operatorSpecified = true;
semsfTranType.@operator = SearchEnumMultiSelectFieldOperator.anyOf;
String [] tranTypes = new String[1];
String tranType = "_salesOrder";
tranTypes[0] = tranType;
semsfTranType.searchValue = tranTypes;
tsb.type = semsfTranType;
// tranId contains 183
SearchStringField sfTranId = new SearchStringField();
sfTranId.searchValue = "183";
sfTranId.@operator = SearchStringFieldOperator.contains;
sfTranId.operatorSpecified = true;
tsb.tranId=sfTranId;
// SO item unfulfilled
SearchBooleanField sbfTranStatus = new SearchBooleanField();
sbfTranStatus.searchValue = false;
sbfTranStatus.searchValueSpecified = true;
tsb.shipRecvStatusLine = sbfTranStatus;
ts.basic = tsb;
tsa4.criteria = ts;
tsa4.columns = tsr;
nss.search(tsa4); 

        

SOAP Request

            <search xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
               <searchRecord xmlns:q1="urn:sales_2017_1.transactions.webservices.netsuite.com"
         xsi:type="q1:TransactionSearchAdvanced">
                  <q1:criteria>
                     <q1:basic>
                        <shipRecvStatusLine xmlns="urn:common_2017_1.platform.webservices.netsuite.com">
                           <searchValue xmlns="urn:core_2017_1.platform.webservices.netsuite.com">false
            </searchValue>
                        </shipRecvStatusLine>
                        <tranId operator="contains" xmlns="urn:common_2017_1.platform.webservices.netsuite.com">
                           <searchValue xmlns="urn:core_2017_1.platform.webservices.netsuite.com">183
            </searchValue>
                        </tranId>
                        <type operator="anyOf" xmlns="urn:common_2017_1.platform.webservices.netsuite.com">
                           <searchValue xmlns="urn:core_2017_1.platform.webservices.netsuite.com">_salesOrder
            </searchValue>
                        </type>
                     </q1:basic>
                  </q1:criteria>
                  <q1:columns>
                     <q1:basic>
                        <internalId xmlns="urn:common_2017_1.platform.webservices.netsuite.com">
                           <customLabel xmlns="urn:core_2017_1.platform.webservices.netsuite.com">Sales Order ID
            </customLabel>
                        </internalId>
                        <item xmlns="urn:common_2017_1.platform.webservices.netsuite.com" />
                        <shipRecvStatusLine xmlns="urn:common_2017_1.platform.webservices.netsuite.com">
                           <customLabel xmlns="urn:core_2017_1.platform.webservices.netsuite.com">Order Item
            Fulfilled</customLabel>
                        </shipRecvStatusLine>
                        <tranDate xmlns="urn:common_2017_1.platform.webservices.netsuite.com" />
                        <tranId xmlns="urn:common_2017_1.platform.webservices.netsuite.com" />
                     </q1:basic>
                  </q1:columns>
               </searchRecord>
            </search>
         </soap:Body> 

        

SOAP Response

          <searchResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
               <platformCore:searchResult
         xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
                  <platformCore:status isSuccess="true"/>
                  <platformCore:totalRecords>1</platformCore:totalRecords>
                  <platformCore:pageSize>10</platformCore:pageSize>
                  <platformCore:totalPages>1</platformCore:totalPages>
                  <platformCore:pageIndex>1</platformCore:pageIndex>         <platformCore:searchId>WEBSERVICES_MSTRWLF_111420081646577959501232561_cb6492913ad1</platformCore:searchId>
                  <platformCore:searchRowList>
                     <platformCore:searchRow xsi:type="tranSales:TransactionSearchRow"
         xmlns:tranSales="urn:sales_2017_1.transactions.webservices.netsuite.com">
                        <tranSales:basic
         xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
                           <platformCommon:internalId>
                              <platformCore:searchValue internalId="987"/>
                              <platformCore:customLabel>Sales Order ID</platformCore:customLabel>
                           </platformCommon:internalId>
                           <platformCommon:item>
                              <platformCore:searchValue internalId="40"/>
                           </platformCommon:item>
                           <platformCommon:shipRecvStatusLine>
                              <platformCore:searchValue>false</platformCore:searchValue>
                              <platformCore:customLabel>Order Item Fulfilled</platformCore:customLabel>
                           </platformCommon:shipRecvStatusLine>
                           <platformCommon:tranDate>
                              <platformCore:searchValue>2008-11-14T00:00:00.000-08:00</platformCore:searchValue>
                           </platformCommon:tranDate>
                           <platformCommon:tranId>
                              <platformCore:searchValue>183</platformCore:searchValue>
                           </platformCommon:tranId>
                        </tranSales:basic>
                     </platformCore:searchRow>
                  </platformCore:searchRowList>
               </platformCore:searchResult>
            </searchResponse> 

        

Related Topics

Transactions
Usage Notes for Transaction Record Types
Transaction Search
How to Use the SOAP Web Services Records Help
SOAP Web Services Supported Records
SOAP Schema Browser
SuiteTalk SOAP Web Services Platform Overview

General Notices