Try our conversational search powered by Generative AI!

Extract orders related to specific supplier in a many to many B2B scenario



Usually, you have the screnario where "Company X" sells to n numbers of customers. When loading a customers orders, you do:


However, in our solution, we need to support n numbers of suppliers selling to n numbers of customers. One order can contain articles from different suppliers. Loading the customers orders we can do as above, however, I'm not sure what strategy to take to load the all orders related to a supplier.

Currently, a reference to the supplier is stored on the line item in commerce.

Does anyone have any input, tips or trix in regards to a good solution to extract orders related to one specific supplier? I came across the "OrderSearchOptions", would that be a good option?



Edited, Mar 27, 2019 13:42

Hi - yes, for now OrderContext.Search is your best bet. We are working on search using abstraction APIs (IOrderSearch), however it is still a long way ahead. 

Sounds like you can search for orders that contains items from a specific supplier by this

var searchParameters = new OrderSearchParameters();

//other things

searchParameters.SqlWhereClause= $" OrderGroupId in (SELECT OrderGroupId From LineItem li INNER JOIN LineItemEx lie ON li.LineItemId = lie.ObjectId WHERE lie.Supplier = {supplier}) ";


Two notes:

Edited, Mar 27, 2019 14:20

Great! Thanks Quan!

This forum is great! <3

Mar 27, 2019 14:41
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.