Thursday, September 11, 2008

DelayActivity Not Working and Creating Simple Escalation

Basically I want to start adding some escalations into my SharePoint state workflows. I want to send emails to people who have been assigned a task.

When I put a Delay Activity into my state workflow, the delay activity would not work. No errors; no nothing. I put in some break points and the event definitely fires however it never wakes up to send the email.

I did some searching and found out rather quickly this seems to be a well known error. Specifically this SharePoint team blog lead me to KB 953630 which discusses the issue. To resolve the issue I had to resolution 1 and 4. First I had to install KB 932394 which just required me to bounce both IIS and the SharePoint Timer service. Next I had to modify the Job-workflow timer using the Stsadm. Let's say you have a reminder that must be sent within two hours, if the Job-workflow time job is configured to go off once a day, your reminder will not be sent.

The reason why I had to install this KB is because my client has not installed the Infrastructure Update for Microsoft Office Servers (KB951297). If you have not installed it yet, please do so! There are a ton of good fixes.

Setting up the Escalation
So to implement an escalation into my state workflow, I simply added two Event Driven activities by right clicking the state. The first uses an OnTaskChanged activity which waits for a user action. The second is the escalation.

Now in the EscalationActivity, I simply put in a delay, an email and a log. Done.
Escalations in Thoughts
In K2, I do not even have to think about how to set up escalations but I had to figure out how to do in WF. First of all from what I read the DelayForActivity and DelayUntilActivities activities that you may see in the tool box have some challenges and work well in SharePoint Designer; not in Visual Studio fromw what I read. I knew I really did not need to use them, so I stuck just to DelayActivity.

I found these two blogs sending a reminder in a sequential workflow and using nested StateActivity to send regular reminders in Visual Studio SharePoint State Machine Workflow. Really they were overkill from what I found and the second article basically was hacking at the workflow to achieve a result where a user will continue to receive reminders until the person takes action. LET ME IMPLORE YOU; I would challenge any business user who claims this is a requirement for an everyday business process. I have seen way to many scenarios using workflow engines (at different client) where set up complex business rules and had expectations that users would be doing stuff in rapid fashion. Trust me, you are building a spam machine and the business users will hate you for it, especially if escalations are going up to the CEO. I HIGHLY recommend that you put in simple escalation rules or none at all until you can do some analysis of the workflow once it has been automated. Once you start collecting rich data about the process, you will identify bottlenecks and that is when you want to start introducing escalations.

No comments: