At work, I’ve (reluctantly) been forced to get to grips with Sharepoint. I’ve done a couple of MCTS things, got some books, read some stuff, and even installed it. I’m still none the wiser.
Well, maybe a little, for instance I’ve been using the BDC for hooking up one of our CRM systems. One of the major selling points of SP is the workflow stuff, and designing very basic sequential workflows in Sharepoint Designer 2007 is really straightforward using the workflow designer wizard. But if you need to do anything more complicated than send an email (not strictly true, but you are quite limited, for instance, you can’t do any string manipulation other than building “dynamic strings”, ugh.), you’ll need to get involved with Visual Studio. And I have to say, as someone coming from a Visual Studio software background, creating workflows in it is a minefield. Certain expectations you may have with Winforms just go completely out the window.
Anyway, this isn’t supposed to be a discussion of it, rather, a few hints and tips that I’ve picked up whilst trying to get things working. Note that I’m using Visual Studio 2008 on an all in one MOSS2007 box (i.e., my development machine) to write these workflows. VS2008 does all of the debugging and deploying for you – I’ve read that if you’re developing on VS2005 then the process is a little different, as you have to manually develop the XML files that make up the package.
1. The workflow engine might not run at all if the web application pool is running as an administrative account. You can change the application pool to a network service in central administration.
2. Workflow failed to start (retrying) – this is a horrible error message. First thing to check is that the correlationtoken is set properly – in theory it should be as VS wouldn’t let you start debugging if it wasn’t. For anyone trying to get their head around what a correlationtoken is, don’t fret too much – it’s just a unique “key” that identifies the workflow. For your WorkflowActivated activity, you could set the token as “WorkflowActivatedToken” and then set the OwnerActivityName to the root class of your workflow. You can use the same correlationtoken for all activities in your workflow EXCEPT to say that logical units of the workflow (e.g., things surrounding the creation/use of tasks etc.) should get a separate token.
2b. If you change the name of your class i.e., from Workflow1 to MyAwesomeWorkflow, Visual Studio unhelpfully does NOT update the workflow.xml file – you should do this manually
2c. Sharepoint does a bollockload of logging, which, if you can trawl through them, might give you some info on the problem. The logs are by default in : %Program Files%\Common Files\Microsoft Shared\web server extensions\12\LOGS
3. In the properties of each your activities/methods, you don’t need to fill in all of the details. In fact, most of them will be empty, e.g., a method doesn’t necessarily need a MethodInvoking method if you don’t need to do anything more complex with it. In fact, you’ll find that if you ask VS to create your eventhandlers, you’ll end up with so much extra gibberish that you just don’t need.
4.
I’ll add more as I come across them, but for now here is a useful link for basic workflowing in Sharepoint / MOSS 2007 and Visual Studio 2008 which has a lovely video you can watch.
Hi Matt,
I’m using VS 2005 and I’m trying to build a simple sequential workflow that creates an activity, assigns it to someone and sends an email notifying that person. However easy it may seem, I keep getting the Failed on Start(Retrying) error, my CorreletationTokens are set correctly and my class name is the default name but I cannot seem to find what the error is. I’m new at this custom workflow thing.
How would you go about creating a simple sequential workflow like the one I mentioned above? Looking forward to your response.
Thanks,
Itumeleng
Hi… did you check the error log for more clues?
Hi,
I managed to fix it by commenting out the TaskListContentTypeId tag and the other tags in the workflow.xml file.
Thanks,
Itumeleng
Hi Matt,
i’m using sharepoint at work and i defined a workflow from the “Approval” type.
the workflow is actually a chain of approvals to a creation of a new event on a list. when one of the approvers rejects, the workflow continues to the next approver, what i want is that when a rejection is made, the workflow would return the last approver (its serial of course).
can that be done somehow?
thanks,
Rea.
Are you doing this in Visual Studio? I think that’s the only way you’d be able to achieve this…