If anyone has tried to log a big message to the Workflow History, you'll find that the some of it is truncated. This is because the message is stored in a Single Line of Text field in SharePoint. This field type has a limit to how much it can hold.
There are times when you need the whole message logged. So the solution is to split the message into more manageable chunks, and write them out one at a time.
There's one caveat. I don't want to have to build this logic every time in every workflow I need. UDA (User Defined Action) to the rescue. That way, it'd almost be a replacement for the out-of-the-box Log in the History List action.
My solution was to split my big message into 255 character chunks. The only way I can think of to do this, is to use a Regular Expression action, configured to do an Extract. The expression to use is :
This expression will match all characters in 255 character chunks, but also at the end if there's left over characters, it'll match that too.
The result is stored into a Collection variable. Then, I use a For Each action to iterate through each chunk, and use a Log in the History List action to log that chunk.
Regularly, I make workflows that call web services. One example is the Lists.asmx web service and the GetListItems web method. This method can return quite a bit of data. I would then add a Send Notification action and add the result of the web service as an attachment to an email, since the data is cropped if I use a Log in the History List action.
When I look at the workflow history, you find that data has been cropped.
So I added my new UDA, and instead of the Log in the History List action, I have my UDA.
The result is more data in the history log. So you should be aware about this. But it may help in some initial workflow design or debugging.
Once you publish the UDA, when you go to design a workflow, you simply add the UDA to the workflow as you would the normal Log in the History List action.
When configuring the action, it will look a little different than a normal Log in the History List action, but should still be easy enoough to use.