Workflow History Not Found in Sharepoint 2010

In this article we can explore a common scenario associated with creating Workflows in Visual Studio 2010.

Scenario

You are creating a workflow through Visual Studio 2010. The SharePoint 2010 templates are installed and while selecting a Workflow template and entering the site URL you receive the following error:

"The SharePoint site at URL is missing a target, task, or history list. Each of these lists is required to associate a workflow template. Please create a list and then launch this wizard."

Scenario.jpg

Root Cause

The Workflow requires the following lists for its working:

  • Workflow History of Template 140
  • Workflow Tasks of Template 107

Solution

There are many solutions to the above problem like:

  1. Create a new site from a site template that includes Workflow History & Task list (Example Team Site template)
  2. Create the 2 lists Programmatically
  3. Create the 2 lists using PowerShell

Here I will apply the second solution, using C# code to create the 2 lists.

Implementation

Create a new SharePoint Console Application and change the project properties as:

  • Target Framework to 3.5

Add the following code to the Main() method. Please change your URL accordingly.

class Program

{

    private static string URL = "http://yourblanksite";

 

    static void Main(string[] args)

    {

        using (SPSite site = new SPSite(URL))

        {

            using (SPWeb web = site.OpenWeb())

            {

                web.Lists.Add("Workflow History", string.Empty, SPListTemplateType.WorkflowHistory);

                web.Lists.Add("Workflow Task", string.Empty, SPListTemplateType.Tasks);

            }

        }

    }

}

Execute the preceding code and if it completed without errors, your problem is solved.

Verification

Inside SharePoint you can verify our new lists as shown below:

Verification.jpg

Inside Visual Studio 2010, try creating the workflow again and you should not see the error. The select lists page should display the new lists which were created.

select-lists-page-sharepoint2010.jpg

Please note that the lists are displayed here based on their Template Id.

Template Enumeration Reference

You can refer to the Template Enumeration (SPListTemplateType) here.

Name

Description

InvalidType

Not used. Value = -1.

NoListTemplate

unspecified list type. Value = 0

GenericList

Custom list. Value = 100.

DocumentLibrary

Document library. Value = 101.

Survey

Survey. Value = 102.

Links

Links. Value = 103.

Announcements

Announcements. Value = 104.

Contacts

Contacts. Value = 105.

Events

Calendar. Value = 106.

Tasks

Tasks. Value = 107.

DiscussionBoard

Discussion board. Value = 108.

PictureLibrary

Picture library. Value = 109.

DataSources

Data sources for a site. Value = 110.

WebTemplateCatalog

Site template gallery. Value = 111.

UserInformation

User Information. Value = 112.

WebPartCatalog

Web Part gallery. Value = 113.

ListTemplateCatalog

List Template gallery. Value = 114.

XMLForm

XML Form library. Value = 115.

MasterPageCatalog

Master Page gallery. Value = 116.

NoCodeWorkflows

No Code Workflows. Value = 117.

WorkflowProcess

Custom Workflow Process. Value = 118.

WebPageLibrary

Wiki Page Library. Value = 119.

CustomGrid

Custom grid for a list. Value = 120.

SolutionCatalog

Solutions. Value = 121

NoCodePublic

No Code Public Workflow. Value = 122

ThemeCatalog

Themes. Value = 123

DataConnectionLibrary

Data connection library for sharing information about external data connections. Value = 130.

WorkflowHistory

Workflow History. Value = 140.

GanttTasks

Project Tasks. Value = 150.

Meetings

Meeting Series (Meeting). Value = 200.

Agenda

Agenda (Meeting). Value = 201.

MeetingUser

Attendees (Meeting). Value = 202.

Decision

Decisions (Meeting). Value = 204.

MeetingObjective

Objectives (Meeting). Value = 207.

TextBox

Text Box (Meeting). Value = 210.

ThingsToBring

Things To Bring (Meeting). Value = 211.

HomePageLibrary

Workspace Pages (Meeting). Value = 212.

Posts

Posts (Blog). Value = 301.

Comments

Comments (Blog). Value = 302.

Categories

Categories (Blog). Value = 303.

Facility

Facility. Value = 402

Whereabouts

Whereabouts. Value = 403

CallTrack

Call Track. Value = 404

Circulation

Circulation. Value = 405

Timecard

Timecard. Value = 420

Holidays

Holidays. Value = 421

IMEDic

IME (Input Method Editor) Dictionary. Value = 499

ExternalList

External. Value = 600

IssueTracking

Issue tracking. Value = 1100.

AdminTasks

Administrator Tasks. Value = 1200.

HealthRules

Health Rules. Value = 1220

HealthReports

Health Reports. Value = 1221

The link is added in the References section too.

References

http://tinyurl.com/sp2010-lsttmpref

Summary

In this article we have explored a common error scenario associated with workflow creation and a solution for it.