One of my clients worked with a previous contractor to build out a small but useful HR application for the enterprise. That contractor used SharePoint Designer to implement the workflow portion of the solution. It’s a bit of a mess. For instance, there are nine SPD workflows in support of a single logical workflow process and up to five of them may fire simultaneously at any given time given the right conditions. It’s not easy to debug 🙂
My customer has a number of still-outstanding requirements, one of which is to generally provide more context when the system sends out email alerts – both in the email itself as well as associated task forms. As SPD workflow implementers know, the “collect data from user” SPD action actually creates a task with a custom content type. When we use that action, we don’t get to specify much. We can prompt for some values (e.g. “approve” or “deny”) and we can specify a hard coded value in the title and description. That’s about it.
My customer’s requirement is two fold:
- When SharePoint sends an email about a task assignment, include a lot of information about the task in the email body.
- More importantly, by far – when the user clicks on the task link in the email, the task form should have all the information the approver needs in order to make his/her approve or deny decision. Right now, the manager needs to click on the item link itself to drill down into the underlying details and no one likes that. You have to click in the email. Then you need to click a sort of obscure link on the task item. Then you can look at the underlying data (an InfoPath form in this case). Then you click back/back, etc. Everyone hates it.
I’ve inherited this somewhat messy technical solution and I want to make changes in the least intrusive way possible.
The approach I’m taking right now is to create a custom alert template. You can read about that here. The flow works like this:
- SPD workflow runs.
- At some point, it assigns a task to a manager.
- SharePoint system automatically sends out an alert to that manager. This is not part of the SPD workflow but rather “what SharePoint does.” (The SharePoint timer service, I believe).
- A custom alert handler is invoked in favor of the standard alert process (following magic rules as described in the above referenced article).
- When my custom alert handler runs, it generates a beautiful email. More importantly, since it has the task in hand, it also decorates the actual task with all the context information necessary to meet the business requirement.
- The user gets the email and it’s full of useful context information.
- User clicks on the task link and the task itself is full of useful context information.
- Everyone goes home to have watermelon and ice cream.
I did a quick POC and it works well in a lab environment. I get my custom email alert as expected. I also get to update the task description and title itself.
The only tricky bit, so far, is to avoid a situation where the alert updates the item, triggering another alert. This doesn’t worry me.
Looks promising so far…
The great thing about this is that I don’t need to muck about with any of the existing SPD workflows. They are blissfully unaware that an alert handler is “IIZ RUNNIN IN DA BAKGROUND, DECORATIN TEH TASK LIST WIF MOAR CONTEXT”.
Subscribe to my blog.
Follow me on Twitter at http://www.twitter.com/pagalvin