Filter or Query itemFulfillment using REST API
How do I request the set of related itemFulfillments for a given SalesOrder using the REST API?
I know I need to create the request based on the itemFulfillment.createdForm.id field, but I do not know how to structure the request.
Here is what I’ve tried:
GET .../itemFulfillment?q=createdFrom IS 10000 Invalid search query Field 'createdFrom' for record 'transaction' was not found..
POST .../suiteql?limit=1&offset=0 requestBody: {"q": "SELECT id FROM itemFulfillment WHERE createdFrom='10000'"} Invalid search query Search error occurred: Record 'itemFulfillment' was not found..
There is no straight forward answer for this. It seems the only way is to query the transaction table and filter by type as well as matching the Sales order ID.
There is an answer to this on this other NetSuite Professionals posted question.
Reviving this as there’s new helpful resources in the world.
The good news is that Netsuite’s new Records Catalog can help a lot with this.
From the Records Catalog, we can see that there is no single record type for Item Fulfillments. Rather, there are just “Transactions” which means you need to search for the item fulfillments you’re interested in. When we get all results for a known Item Fulfillment using SuiteQL (see the request), the results do not include the createdFrom
field. The results also don’t include any information about the items that were fulfilled. Again, from the Records Catalog, we can see that there is another location to search to find those: the transactionLine table, and that that table has a createdFrom
field. Using Netsuite’s usual formula-based-join syntax, we can find all lines on all Item Fulfillments that were created from this sales order using this query:
POST {{REST_SERVICES}}/query/v1/suiteql BODY: { "q": SELECT * FROM transactionLine WHERE transactionLine.createdfrom = '{{your sales order number here}}'"}
This isn’t the whole story, though. When I perform this search on a transaction which only has a single Item Fulfillment with a single line fulfilled, I get 3 results. You might need to find some way to filter or combine them. Perhaps it’s getting results from the original Sales Order as well, or some other transaction record.
This is great. Thank you very much for the response.