How to gather all the related line items from an associated object?
I am trying to show all the associated Order Item(s) that are related to the Order. I have attempted both the parameter "order" and the data view1 association, but both are returning empty. Can someone give me some recommendations on how to gather the many OrderItems that are associated with an Order?
I wonder where you associate your order items with the order, since these normally show up when you do the actions you mentioned.
To check if there is any data in the association I would do (one of) the following:
Create a microflow where you pass along a parameter of order (make sure security settings are set well). As a first action in the microflow, you retrieve your order items by association. When you have done this, place a breakpoint on this microflow (you might need to rerun your application).when this is done, you can trigger the microflow from your page, and you will be blocked in the breakpoint (more about this here). If you notice that your OrderItemList is empty, there are no associated objects.
Perhaps a bit easier: whilst your application is running, you can go to the console tab > advanced > start built-in database viewer. Another window will open.
Track down the $order_orderitem association, right click it and select 'Select * from [Your association]'
Execute the SQL command. If there are any associations in the output, it means that you have associations between order and orderitem in your application.
However, whilst these are fine actions, your own options would normally work as well. So I wonder whether the creation of the association might fail somehow.
Let me know if this was helpful.
Juriaan Van Kerckhove
So I have resolved this on my own, the issue was that when I create the orderitem object. In a 1 to many relationship, it is best practice to assign where your many object is related to the 1 object. Thankfully I am passing the 1 "order" object into this microflow , you need to explicitly define that this is a reference to your 1to* relationship.