RE: Pull itemFulfillment using SalesOrder information
Using the REST API, how do I pull all related item fulfillments for a given sales order?
Ultimately I need the ship date, ship method, carrier and tracking number and quantity fulfilled for each fulfillment, so I can report these fulfillments to another system.
Quantity fulfilled is the only one I’ve been able to find in the sales order under items.
You have 3 options for searching: Record Collection Filtering, SuiteQL Queries, or SuiteAnalytics Workbooks
Its unlikely that you will be able to use the createdFrom
as a filter for record collection filtering. The metadata for item fulfillments lists the filterable fields in the x-ns-filterable
key and createdFrom
is not a filterable field. For example, my account has the filterable fields as ["trandate","externalId","memo","id","postingperiod","status","createdDate","tranId","lastModifiedDate","entity"]
. You might be able to do something like place the create from id value in a custom field and filter based off of that.
A SuiteAnalytic Workbook will not be able to be dynamic, you won’t be able to get information for a specified sales order since you cant add filters to the existing workbook.
That leaves SuiteQL as the least hacky solution. I personally favor creating the dataset in the ui, then loading the dataset in suitescript to get the SuiteQL. The following SuiteQL is what NetSuite generates for a basic transaction query thats gets the internal id of transactions where the created from internal id is 1542 and the type is item fulfillment:
SELECT "TRANSACTION"."ID" AS idRAW /*{id#RAW}*/ FROM "TRANSACTION", PreviousTransactionLink WHERE "TRANSACTION"."ID" = PreviousTransactionLink.nextdoc(+) AND ((UPPER("TRANSACTION"."TYPE") IN ('ITEMSHIP') AND PreviousTransactionLink.previousdoc IN ('1542')))
You can create a similar query to get all the item fulfillents internal ids and get each individual one to get the information you need. Ideally you make the query also contain all the columns you need so that you dont need to get each item fulfillment.