ANS-1283 · WEB SERVICES & INTEGRATIONS

How to Retrieve NetSuite Item Fulfillments by Location Using Web Services

When multi-location is enabled, NetSuite generates separate item fulfillments for items from different locations, which can be accessed via Web Services using Ship Group IDs.

Short answer

To retrieve specific item fulfillments by location via Web Services, use the initialize call on Item Fulfillments. Provide the Sales Order ID and the relevant Ship Group ID as auxReference with type shippingGroup. NetSuite automatically assigns Ship Group IDs to items from the same location on a sales order.

Scenario

When multi-location inventory is enabled on a NetSuite sales order, it is not possible to create a single item fulfillment that contains items from different locations. Instead, NetSuite automatically generates multiple item fulfillments, with each fulfillment grouping items from a single location. This behavior is observed when fulfilling directly within the NetSuite UI.

Solution

To recreate this behavior and retrieve specific item fulfillments by location via Web Services, the initialize call on Item Fulfillments must be used. This call requires two parameters: the Sales Order to reference and the Ship Group ID for the desired fulfillment.

Ship Groups are automatically generated by NetSuite at the time of sales order creation, with a unique ID assigned to each group of items originating from a different location. For example, all items from Location A will share one Ship Group ID, while items from Location B will have a different Ship Group ID.

Below is an example of a Ruby code snippet demonstrating the initialize call:

ruby
aux_reference = {
  aux_reference: {
    internal_id: ship_group,
    type: "shippingGroup"
  }
}

fulfillment = NetSuite::Records::ItemFulfillment.initialize(@sales_order, aux_reference)

The corresponding SOAP call structure for this operation is as follows:

xml
<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>

In summary, to retrieve a specific item fulfillment, the Sales Order ID and the corresponding Ship Group ID are required. These must be passed within the initialize call by specifying an auxReference with the type set to shippingGroup.

Expert NetSuite Support

Need help with this NetSuite issue?

Web Services & Integrations consulting and configuration support

Talk to a consultant