Skip to main content

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.

Comments

Popular posts from this blog

Oversized buttons in IE

Yeah ... just another problem with IE. Lucky for all of us there are some people that can hack their way through the IE bugs. Here is a fix for this problem: input.button {   padding: 0.25em;   width: 0;   overflow:visible; } input.button[class] { /*ie ignores [class]*/   width: auto; }

Emmet in Visual Studio Code | cheat sheet link

Support for   Emmet   snippets and expansion is built right into Visual Studio Code,   no extension required .   Emmet 2.0   has support for the majority of the   Emmet Actions   including expanding   Emmet abbreviations and snippets .   Emmet is a web-developer’s toolkit that can greatly improve your HTML & CSS workflow   Links: Emmet in Visual Studio Code   Cheat Sheet (emmet.io)  

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...