Try our conversational search powered by Generative AI!

[EPi 10.5.1] Error message "field can't be null" when converting cart to purchase order

Vote:
 

Hi,

When trying to convert a cart to a purchase order, either by using method SaveAsPurchaseOrder() or through EPiServer Commerce GUI, we get the error message: "field can't be null" or "Failed to create Purchase Order. Error: field can't be null" respectively.

I suspect there are problems when EPiServer tries to copy the metadata from a lineItem but I am just guessing here. I've tried removing the metadata but it did not help.

Does anybody know or have any idéa about what's causing this error?


An error has occurred.
field can't be null
System.NullReferenceException

at Mediachase.Commerce.Storage.MetaStorageBase.DoGetByIndex(MetaField field) at Mediachase.Commerce.Orders.LineItem..ctor() at EPiServer.Commerce.Order.Internal.OrderGroupBuilder.CreateLineItem(String code) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyLineItems(IShipment sourceShipment, IShipment destinationShipment, IOrderGroup destinationOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyShipments(IOrderForm sourceForm, IOrderForm destinationForm, IOrderGroup destinationOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyOrderForm(IOrderGroup orderGroup, IOrderGroup sourceOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyFrom(IOrderGroup orderGroup, IOrderGroup sourceOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.Internal.SerializableCartProvider.SaveAsPurchaseOrder(ICart cart) at EPiServer.Commerce.Order.DefaultOrderRepository.SaveAsPurchaseOrder(IOrderGroup orderGroup) at 
#178776
Edited, May 22, 2017 13:18
Vote:
 

Hi,

We would need more information regarding this case. I would suggest you to contact our developer support for further assistance, we probably need to look at your metafields, and your code.

#178793
May 22, 2017 15:58
Vote:
 

It looks like you are using the new Serialized carts, i would suggest you make sure that the LineItem used by the orders actually have all the fields that are present in the serialized data.

I have not used the new carts myself thou.

Kind regards

Erik

#178794
May 22, 2017 16:02
* 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.