Tuesday, 19 February 2013

CreateTaskWithContentType (01)

Creating a Task with a custom content type turned out to be a nightmare... I'm putting this together so that it doesn't become a reoccurring one. There are seven steps to pushing through this kerfuffle.

Create a Workflow Project

It doesn't really matter whether you make a sequential or state machine workflow; a State Machine workflow will add it's own level of complexity, but since this post is focusing on the CreateTaskWithContentType activity I'm going to create a sequential to simplify this example as much as possible.

1.) Add a Sequential workflow project to your solution. Right click your solution->Add->New Project.

2.) Next, pick your site with port number and you shouldn't have a choice but too deploy as a farm solution.

3.) Now you have to name your workflow and select whether it's a list or a site, I'm going with List though I'd imagine it shouldn't make a difference, but don't quote me on that.

4.) At this final junction you'll basically have two choices, either specify all your details or do it manually later, since the whole point of this series of posts is to create your own custom task list with custom content type it doesn't  make too much sense to define them now. Disable the automatic association.


WOOT WOOT, you've just created your sequential workflow project, feel great? you shouldn't it's only going to get worse from here on in.

Continued in Part 02; creating Site Columns, Content Type, List Definition, List Instance.