This is one of the areas I really struggled in when I moved from creating SharePoint & InfoPath form based workflows to creating WSS workflows that use ASPX pages for task forms.
Because WSS does not include ‘Forms Services’, the technology which allows the use of InfoPath forms in a web browser, the only real solution is to create some aspx pages to use for the task forms.
While looking round on the net, I noticed there was a lack of any workflow tutorials for WSS so I have decided to create a four part tutorial. In this tutorial in we will create a simple workflow allowing us to explore the steps required to develop workflows for the WSS platform.
In Part 1 of the tutorial we will look at a simple workflow process and will set up our Visual Studio project and batch file. In Parts 2 and 3 we will code the solution and in Part 4 we will deploy the solution to WSS.
Before we start I’d like to point out some of the annoyances I have encountered with ASPX based workflows:
- You cannot visually design the ASPX pages if you inherit from the SharePoint default and application.master pages, the best way to get around this is to design the pages in a separate Visual Studio project and then copy the code over.
- Any task that contains different fields/metadata will need its own Content Type, this means if you have a large workflow you will have many Content Types.
- When you create a task using a ‘CreatetaskwithContentType’ activity it does not associate the Content Type to the Task list for you, you will need to run some code before the activity to add the Content Type at runtime.
Other than the above, I cannot find much more to complain about :p.
So, let’s imagine that we need to create a workflow to mimic the process below:
As you can see this is a fairly simple approval process, we can add a number of log activities throughout the workflow to enhance it further.
As you probably already know, there are two types of SharePoint/WSS Workflow – Sequential or State Machine.
- Sequential – These are workflows that progress in a flowchart style nature and cannot go back in the process.
- State Machine – These workflows progress from ‘State’ to ‘State’ and can go back at anytime in workflow. There is greater flexibility.
We will use State Machine for this tutorial as when the item is rejected, we need to go back to the previous task. We now need to configure Visual Studio, I will use Visual Studio 2008 for this tutorial, however you can use 2005 if needed.
Begin by creating a blank C# State Machine Library Project in Visual Studio:
Configure the solution explorer like the below example by adding the relevant folders, this will help us when we come to deploy our workflow to WSS.
In addition rename the Worklow1 class to something more meaningful and strongly sign the assembly to create an .snk file by using the Project > Signing dialog box.
We will use the Features directory to store the feature files, Images for any custom images we might add and the Layouts to store our ASPX forms.
This is the end of Part 1, stay tuned for Part 2 within the next few days!!