You need to use the overload with Dictionary<String,Oject> and pass in {"OrderGroup", cart } so it has the correct properties to run the workflow against
Thanks Mark!
Not sure where to pass that dictionary object, but calling the workflow using OrderGroupWorkflowManager fixed our problem.
So now I would call :
OrderGroupWorkflowManager.RunWorkflow(_carthelper.Cart, "workflowname");
I also had the change the namespace and assembly name in ecf.Workflow.Config file. Doing this the built in workflows worked perfectly!
You can pass the dictionary by the ActivityFlowContext, something like this:
var context = new ActivityFlowContext(dict);
ServiceLocator.Current.GetInstance<ExecutionManager>().ExecuteActivityFlow(OrderGroupWorkflowManager.CartValidateWorkflowName, context);
You should not need to change the namespace and assembly name in ecf.Workflow.Config
Regards,
/Q
Thanks Quan! Will try the context way.
Regarding the ecf.Workflow.Config, you are right. No change there.
We recently upgraded to 9.6. The project was using the workflows earlier like _carthelper.Cart.RunWorkflow("..").
This is now changed to :
WorkflowResults wr = ServiceLocator.Current.GetInstance().ExecuteActivityFlow(OrderGroupWorkflowManager.CartValidateWorkflowName);
This executes fine, but the result object (WorkflowResults) is filled with exception. And status is "Aborted"
The exception that is thrown is :Validation Error: Number 278 - 'Property OrderGroup not set.'
Full Stack strace is below:
wr.Exception =
{"Validation Error: Number 278 - 'Property OrderGroup not set.' \n"} [Mediachase.Commerce.WorkflowCompatibility.WorkflowValidationFailedException]: {"Validation Error: Number 278 - 'Property OrderGroup not set.' \n"} _className: null _data: null _dynamicMethods: null _exceptionMethod: null _exceptionMethodString: null _helpURL: null _HResult: -2146233088 _innerException: null _ipForWatsonBuckets: 58730441 _message: "Validation Error: Number 278 - 'Property OrderGroup not set.' \n" _remoteStackIndex: 0 _remoteStackTraceString: null _safeSerializationManager: {System.Runtime.Serialization.SafeSerializationManager} _source: null _stackTrace: {sbyte[192]} _stackTraceString: null _watsonBuckets: null _xcode: -532462766 _xptrs: 0 Data: {System.Collections.ListDictionaryInternal} HelpLink: null HResult: -2146233088 InnerException: null IPForWatsonBuckets: 58730441 IsTransient: false Message: "Validation Error: Number 278 - 'Property OrderGroup not set.' \n" RemoteStackTrace: null Source: "Mediachase.Commerce.Workflow" StackTrace: " at Mediachase.Commerce.Workflow.Activities.OrderGroupActivityBase.ValidateRuntime()\r\n at Mediachase.Commerce.Workflow.Activities.ValidateLineItemsActivity.Execute(ActivityExecutionContext executionContext)\r\n at Mediachase.Commerce.WorkflowCompatibility.Activity.Execute()\r\n at Mediachase.Commerce.Engine.ActivityFlowRunner.<>c__DisplayClass1`1.b__0()\r\n at Mediachase.Commerce.Engine.ActivityFlowRunner.Execute()\r\n at Mediachase.Commerce.Engine.ExecutionManager.ExecuteActivityFlow(String name, ActivityFlowContext context)" TargetSite: {Boolean ValidateRuntime()} WatsonBuckets: nullwr.Exception.StackTrace" at Mediachase.Commerce.Workflow.Activities.OrderGroupActivityBase.ValidateRuntime()\r\n at Mediachase.Commerce.Workflow.Activities.ValidateLineItemsActivity.Execute(ActivityExecutionContext executionContext)\r\n at Mediachase.Commerce.WorkflowCompatibility.Activity.Execute()\r\n at Mediachase.Commerce.Engine.ActivityFlowRunner.<>c__DisplayClass1`1.b__0()\r\n at Mediachase.Commerce.Engine.ActivityFlowRunner.Execute()\r\n at Mediachase.Commerce.Engine.ExecutionManager.ExecuteActivityFlow(String name, ActivityFlowContext context)" > >