Writing History events from a SharePoint designer Workflow
Most SharePoint 2010 solutions will have some form of workflow associated with them.
Workflows written in SharePoint designer can be powerful, but tricky to troubleshoot if they do not work correctly.
Some workflows will complete but not perform as expected, and some will simply fail with the ever helpful An error has occurred in <Workflow Name> written to the history list.
To help us out with this is the Log to History List core action in our workflow designer Action List.
This allows us to write a message to the workflow history, and as such we could write back the value of a workflow parameter or variable that we can check on.
To illustrate this I have written a one step workflow with one Variable and one Parameter, the workflow has an Initiation Form that allows a user to select a colour.
We set the variable varColour to be the value of the colour the user selected which is stored in the parameter ParamColour , on the second line we use the Log to History List to output the value of varColour to the workflow history.
This is what it looks like, firstly we choose a colour from the Initiation Form
The workflow processes and completes, when we check the History list we can see that our message and the value of varColour have been recorded in the Workflow History list
Normally the Workflow History list is hidden from the browser, but you can change this setting in SharePoint Designer.