AI OnAI Off
I found the solution myself. And actually it was already on the previous post. I accidentally copied the bottom of the code snippet from other place, where similar feature was working all the time. From there I found the solution.
Previously I was running the workflows from the CartHelper. But running the workflow directly against cart fixed the issue for me. Basically I changed the RunWorkflow line from:
newCartHelper.RunWorkflow(OrderGroupWorkflowManager.CartValidateWorkflowName);
to
newCartHelper.Cart.RunWorkflow(OrderGroupWorkflowManager.CartValidateWorkflowName);
Some instructions say that the workflows should be run directly from CartHelper, so is this a bug or something else?
I'm running EPiServer Commerce version 9.0.0
I am trying to copy details of the details of the default cart to other custom named draft cart that is later to be accessed. I can successfully copy the details manually, but as I initially tried to run the CartValidate workflow for calculating totals, I got an error:
[KeyNotFoundException: The given key was not present in the dictionary.]
Mediachase.Commerce.Website.Helpers.CartHelper.RunWorkflow(String name) +375
Following is an example which causes the error:
The execution crashes on
I managed to the copy all the details manually, but I'd like to if you can run the cart validation against some custom cart?
And what is the dictionary that is throwing the KeyNotFoundException?
Or what is the suggested way of doing this copying?
Any help is appreciated.