Skip to main content

Posts

Showing posts with the label SharePoint 2010 State Machine Workflow

SharePoint 2010 State Machine Workflow error: "Failed to Start Workflow"

I've been working on a custom state machine workflow for a specific content type. I've associated the workflow to the content type like this: < AssociationCategories > ContentType ; 0x01........ </ AssociationCategories > This workflow has a custom initiation form, in which I'm passing some options to the workflow. After doing the association to the content type I started getting the following error: "Failed to Start Workflow" After doing a bit of debugging and head scratching I found that in the  StartListWorkflow () method inside the initiation page in which the workflow association is retrieved from the workflowList.WorkflowAssociations list and it does not take into consideration the ContentType workflow associations. private void StartListWorkflow () { SPWorkflowAssociation association = this . workflowList . WorkflowAssociations [ new Guid ( this . associationGuid )]; this . Web . Site . WorkflowManager . StartWork...

System.InvalidOperationException: The event receiver context for Workflow is invalid.

Ever got this error while developing SharePoint 2010 Workflows in Visual Studio? System.InvalidOperationException: The event receiver context for Workflow is invalid. at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext() at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds) at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds) Check the you have set the all the TaskIds in your code: TaskId = Guid.NewGuid(); If this is not the case need to check that your Correlation Tokens are setup correctly.