"No activity flow model named CartValidate has been registered." (Upgrading commerce to 9.24.1)

Vote:
 

Hi everyone,

I'm having some issues with upgrading our episerver installation from 8 to 9.24.1.

When trying to run the CartValidate workflow, I get this error:

System.ApplicationException: Workflow generated an exception, please look at the previous error for more details. ---> System.ArgumentOutOfRangeException: No activity flow model named CartValidate has been registered.
Parameter name: name
   at Mediachase.Commerce.Engine.ExecutionManager.ExecuteActivityFlow(String name, ActivityFlowContext context)
   --- End of inner exception stack trace ---
   at Mediachase.Commerce.Orders.Managers.OrderGroupWorkflowManager.RunWorkflow(OrderGroup orderGroup, String name, Boolean async, Boolean throwException, Dictionary`2 param)
   at Mediachase.Commerce.Orders.OrderGroup.RunWorkflow(String name)
   at X.Core.Order.Cart.CartSanitizer.ValidateCart() in C:\projekt\X\Src\Core\Order\Cart\CartSanitizer.cs:line 49

I have looked into this thread and did the following steps to try to solve this:

1. Added 

ServiceLocator.Current.GetInstance<ExecutionManager>();

to the initialization module. (I'm not sure how to verify that this runs.)

2. Used ILSpy to look into the Mediachase.Commerce.Workflow to verify that it includes the class 'CartValidateActivityFlow':

It does not seem that the class exists. The workflows are split into two different projects, Mediachase.Commerce.Workflow and Mediachase.Commerce.Workflow.Activities. I used the Workflow migration tool downloaded here to migrate the old workflows to use the new engine.

#247959
Feb 01, 2021 13:38
Vote:
 

How does your CartValidateActivityFlow look like? It should have this attribute decorated:

    [ActivityFlowConfiguration(Name = OrderGroupWorkflowManager.CartValidateWorkflowName)]

#247966
Feb 01, 2021 16:03
Vote:
 

Here's CartValidate.cs. It seems to be decorated as you described.

namespace Mediachase.Commerce.Workflow
{
    using Mediachase.Commerce.Orders;
    using System.Collections.Specialized;
    using System.Collections.Generic;
    using Mediachase.Commerce.Inventory;
    using System.Linq;
    using Mediachase.Commerce.Engine;
    using Mediachase.Commerce.Orders.Managers;

    [ActivityFlowConfiguration(Name = OrderGroupWorkflowManager.CartValidateWorkflowName)]
    public class CartValidate : Mediachase.Commerce.Engine.ActivityFlow
    {
        
        [Mediachase.Commerce.Engine.ActivityFlowContextPropertyAttribute()]
        public OrderGroup  OrderGroup { get; set; }//;
        
        [Mediachase.Commerce.Engine.ActivityFlowContextPropertyAttribute()]
        public StringDictionary  Warnings { get; set; }//;
        
        [Mediachase.Commerce.Engine.ActivityFlowContextPropertyAttribute()]
        public Dictionary<int, IWarehouse> PickupWarehouseInShipment { get; set; }//;
        
        public override Mediachase.Commerce.Engine.ActivityFlowRunner Configure(Mediachase.Commerce.Engine.ActivityFlowRunner activityFlow)
        {
            return activityFlow
                .Do<Mediachase.Commerce.Workflow.Activities.ValidateLineItemsActivity>()
                .Do<Mediachase.Commerce.Workflow.Activities.Cart.GetFulfillmentWarehouseActivity>()
                .If(() => CheckInstoreInventory())
                    .Do<Mediachase.Commerce.Workflow.Activities.PurchaseOrderActivities.CheckInstoreInventoryActivity>()
                .Else()
                    .Do<Mediachase.Commerce.Workflow.Activities.CheckInventoryActivity>()
                .EndIf()
                .Do<Mediachase.Commerce.Workflow.Activities.CalculateTotalsActivity>()
                .Do<Mediachase.Commerce.Workflow.Activities.RemoveDiscountsActivity>()
                .Do<Mediachase.Commerce.Workflow.Activities.CalculateDiscountsActivity>()
                .Do<Mediachase.Commerce.Workflow.Activities.CalculateTotalsActivity>()
                .Do<Mediachase.Commerce.Workflow.Activities.Cart.RecordPromotionUsageActivity>()
                .Do<Mediachase.Commerce.Workflow.Activities.CalculateTaxActivity>();
        }
        
        private bool CheckInstoreInventory()
        {
            Mediachase.Commerce.WorkflowCompatibility.ConditionalEventArgs e = new Mediachase.Commerce.WorkflowCompatibility.ConditionalEventArgs();
            e.Result = PickupWarehouseInShipment != null && PickupWarehouseInShipment.Any();

            return e.Result;
        }
    }
}
#247967
Feb 01, 2021 18:17
Vote:
 

Try with this way:

Remove Mediachase.Commerce.WorkflowSystem.Workflow.ActivitiesSystem.Workflow.ComponentModel andSystem.Workflow.Runtime referenced assemblies from the Workflow and Activity projects and add them back with new version.

#247970
Feb 01, 2021 20:58
* 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.