Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a feature. In the FeatureActivated event I am creating some lists. I am then trying to attach a custom workflow to one of the created lists. However when I do this the workflow history list that I create disappears.

Here is the code that associates the workflow to the list.

var workflowAssociation = SPWorkflowAssociation.CreateListAssociation(workflowTemplate[id], "Submit For Approval", taskList, historyList);
                workflowAssociation.AllowManual = true;
                workflowAssociation.AutoStartChange = false;
                workflowAssociation.AutoStartCreate = false;
                underApprovalList.WorkflowAssociations.Add(workflowAssociation);
                workflowAssociation.Enabled = true;

Where:

  • workflowTemplate[id] is web.WorkflowTemplates[id of template]
  • taskList non null splist created with SPListTemplateType.Tasks
  • historyList non null splist created with WorkflowHistory
  • underApprovalListnon null splist of SPListTemplateType.DocumentLibrary type

When I comment this code out of the event the historyList is created. When I do not comment it out it is not.

Update

The history list is there if you navigate by URl rather than look for it. So the problem seems to be that the workflowAssociation is not working...

share|improve this question
add comment

1 Answer

My understanding is that Workflow history is not reliable (more so if you have multiple independent workflows active against a specific list).

One way to avoid that problem is to consider creating a custom list to store all of your audit type information.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.