Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Possible exception when validating inventory with workflow

Found in

EPiServer.Commerce 11.0.0

Fixed in

EPiServer.Commerce 11.2.5

(Or a related package)

Created

Sep 18, 2017

Updated

Sep 29, 2017

State

Closed, Fixed and tested


Description

Reported from http://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2017/9/workflow-exception-after-upgrade-to-commerce-11/?pageIndex=1#reply

If a cart has two or more lineitems which do not have enough quantity in inventory, an exception might be thrown.

2017-09-17T23:43:55,Error,scdomstr012im9nprod,943134,636412886352348485,0,3024,70,"EPiServer.Global : 1.2.5 Unhandled exception in ASP.NET
System.ApplicationException: Workflow generated an exception, please look at the previous error for more details. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'rejectedinventoryduetoinsufficientquantity' Key being added: 'rejectedinventoryduetoinsufficientquantity'
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at Mediachase.Commerce.Workflow.Activities.Cart.AdjustInventoryActivity.RequestInventory(OrderForm orderForm, Shipment shipment, LineItem lineItem)
at Mediachase.Commerce.Workflow.Activities.Cart.AdjustInventoryActivity.Execute(ActivityExecutionContext executionContext)
at Mediachase.Commerce.WorkflowCompatibility.Activity.Execute()
at Mediachase.Commerce.Engine.ActivityFlowRunner.<>c_DisplayClass15_0`1.<Do>b_0()
at Mediachase.Commerce.Engine.ActivityFlowRunner.Execute()
at Mediachase.Commerce.Engine.ExecutionManager.ExecuteActivityFlow(String name, ActivityFlowContext context)