SharePoint Workflow: Failed on Start (retrying)


We created a visual studio workflow which contains initiation form. Workflow was associated with multiple content types. Workflow works well when deployed using visual studio. When workflow deployed using WSP, it was crashed showing “Failed on Start (retrying)” or “Error Occurred” status.


When we add “Workflow Initiation Form” using “Add” -> “New Item”, following method is responsible for running workflow:

void StartListWorkflow()


SPWorkflowAssociation association = this.workflowList.WorkflowAssociations[new

this.Web.Site.WorkflowManager.StartWorkflow(workflowListItem, association, GetInitiationData());

SPUtility.Redirect(this.workflowList.DefaultViewUrl, SPRedirectFlags.UseSource, HttpContext.Current);


In the above method, following method looks for workflow association with the list:

SPWorkflowAssociation association = this.workflowList.WorkflowAssociations[new

But we have associated workflow with the content types, not with the list. This results in null value in the SPWorkflowAssociation type variable “association”. When “StartWorkflow” is called, it resulted in exception.

We changed the above line of code with following line:

SPWorkflowAssociation association = this.workflowList.ContentTypes[this.workflowListItem[“Content Type”].ToString()].WorkflowAssociations[new

In the above code, instead of finding association from list, workflow looks association using content type as workflow is associated with content type not list. This did the trick.



  1. Kamesh said

    Above line is still returning null. I used below line which worked.
    SPWorkflowAssociation association = this.workflowList.WorkflowAssociations[new Guid(this.associationGuid)];

    if (association == null)
    association = this.workflowListItem.ContentType.WorkflowAssociations[new Guid(associationGuid)];

  2. Anonymous said

    Thanx you

  3. Thanks! As a newbie sharepointer this was a great help for me. I would like to add that the immediate window in Visual studio should be used a lot to get insights in how the API is built. In the solution you provided “Content Type” was exchanged for the content type id. However, there are three different types of parameters you can pass.

    • Farhan Faiz said

      Thanks for your comments. I will really appreciate if you can share the details of parameters as well. Thanks again.

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: