blogging about SharePoint, Technology, and more!

As I continue to work in SharePoint 2010 and enhancing our corporate Intranet, I’m getting more creative with my basic workflows built out of SharePoint designer. And as workflow logic complexity increases, it also becomes more error prone. Besides creating lots of extra log entries scattered throughout my workflows, I stumbled upon a clever idea to get alerted when an error occurs.

In a nutshell, what it involves is creating an alert based on a workflow status. When a workflow is created, a new column is created that allows you to monitor a workflow’s status. While the default display of this column is a link to the workflow status page (also where you can find the log entries), the workflow status also corresponds to a numerical Event Type code. Build an alert based on that error code and voila! You’ll get notified when an error occurs!

Here’s a recipe for how to get alerts on event errors:

On any SP list with a workflow, create a new calculated column.

Name: IsError (or something meaningful)

Formula: =OR([Event Type]=0,[Event Type]=10)

Data Type: Yes/No

Create a new view (e.g. Workflow Errors) that contains this column (You’ll need this to create an alert based on the view, and avoid exposing this to end users)

After the view is created, be sure to navigate back to that view of the list, and create an alert by clicking the “Alert Me” button in the ribbon. Use the following settings:

Change Type: choose the change type that correspond with how the WF is initiated (e.g. if the WF only fires when new items are created, so should your alert).

Send Alerts for These Changes: choose the last option, “Someone changes an item that appears in the following view” and choose the view you just created in the dropdown.

When to send alerts: choose the frequency that suits you.

That it! This is just a basic recipe, but you can change the ingredients how you like.