Our monthly Virtual Happy Hour is happening this week, Fri Feb 23!

Try our conversational search powered by Generative AI!

Error getting lineitems from shipment



Yesterday we updated to the latest epi version. We seem to have a problem getting lineitem data from a shipment now.

Before we could use shipment.LineItems to get LineItem objects including all meta data but now we get InMemoryLineItem instead which is not castable to LineItem. 

What is the thinking here, that we iterate the lineitems from a shipment, and using the lineitemid to get the real lineitem from the orderform?

Jul 13, 2016 11:00


What would you do with the LineItems? Note that once you use shipment.LineItems, you enter the realm of abstractions and you should be using abstractions all the way.


Jul 13, 2016 11:23

In 9.12 it was working fine to for example do a foreach (var lineitem in shipment.LineItems) and get access to lineitem["metafieldname"], lineitem.ListPrice and so on. That's what we've done in our order history feature for example.

I've changed to fetch the "real" lineitem from the orderform to make this work. I think this should be considered a breaking change.

Jul 13, 2016 11:32

Yes it is indeed a breaking change, as IShipment/ILineItem,etc. were marked as BETA and is supposed to change - until 9.19 when it comes out of BETA.

For your case, I think you should still be able to access such field - both reading and saving via ILineItem.Property 


Jul 13, 2016 11:40

Alright thanks. I didn't realize it was beta. I mean Shipment.LineItems has been around for ages. 

I can accept that the underlying implementation is beta, but the property itself which has been around since Mediachase should in my opinion not be. And should not change behavior so it breaks existing implementations.

Jul 13, 2016 12:55

IShipment.LineItems had been always BETA. Previously there was only OrderForm.LineItems, and then you have to call Shipment.GetShipmentLineItems to get IEnumerable<LineItem> of a shipment.

Jul 13, 2016 13:00

Alright, thanks for your quick replies :)

Sorry for mixing things up.

Jul 13, 2016 13:17

Also you dont need to get from the order from.  You can just use Shipment.LineItems.First().Properties["ListPrice"] = 99;  Then if you call IOrderRepostitory.Save it will sync any of the meta fields to the lineitem implementation. 

Jul 14, 2016 11:10
* 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.