AI OnAI Off
To pass in which page the approval workflow should operate on you should do something like:
Dictionary<string, object> args = new Dictionary<string, object>();
args.Add("PageArgs", new WorkflowPageEventArgs(WorkflowPageEvent.None, CurrentPage.PageLink, PageReference.EmptyReference, null, null);
EPiServer.WorkflowFoundation.WorkflowSystem.InstanceHandler.StartInstance(def.DefinitionId, args , CurrentPage.PageLink, EPiServer.Security.AccessLevel.Read);
I have a client that is getting the same error message when starting any of the 4 supplied workflows in EPiServer 6 - any information regarding how to overcome this problem would be warmly received
I am trying to start a specific workflow instance defined using the default episerver workflow .I tried he code bellow and i get an error:
Starting of instance was cancelled by event handler to InstanceStarting, reason: No valid page is selected for approval workflow” exception
Can you tell if I'm missing something or maybe this is not the proper aproach to do this
EPiServer.WorkflowFoundation.StorageProviders.ObjectStoreStorageProvider Storage = new ObjectStoreStorageProvider();
IList<WorkflowDefinition> instances = Storage.LoadDefinitions();
foreach (WorkflowDefinition def in instances)
{
if (def.PageRoot.ID == CurrentPage.PageLink.ID)
{
EPiServer.WorkflowFoundation.WorkflowSystem.InstanceHandler.StartInstance(def.DefinitionId, def.StartParameters , CurrentPage.PageLink, EPiServer.Security.AccessLevel.Read);
}
}
Thanks