Last week, I was working out how to loop and implement a state machine using SharePoint Designer and mentioned, as an aside, that I would probably write a blog post about better workflow logging.
Well, Sanjeev Rajput beat me to it. Have a look.
Saving log data into a custom list seems superior to using the regular workflow history:
- It’s just a custom list, so you can export it to excel very easily.
- You can create views, dynamically filter the data, etc.
- It’s not subject to the auto-purge you get with regular workflow history.
There are some risks / downsides:
- Many running workflows with a lot of logging could cause too much data to be written to the list.
- Maybe you *do* want automatic purging. You don’t get that feature with this approach (without coding).
- Security is tricky. In order to write to the list, the user must have permission to do so. That means that it’s probably not suitable for any kind of "official" audit since the user could discover the list and edit it. This could be overcome with some custom programming.