Question

I'm trying to send messages to the workflow history of a workflow at some point after the workflow starts, based on a condition. There are some values in the code I would like to verify as the workflow progresses. I found these links:

http://msdn.microsoft.com/en-us/library/ff798337.aspx https://alrickdev.wordpress.com/2012/04/22/programmatically-writing-to-workflow-history-list-sharepoint-2010/

They present two different ways of doing this, but neither work in my situation. The first link says to write the messages in the Execute method, which does work but doesn't help me (only writes messages when the workflow starts). The second link uses SPWorkflow.CreateHistoryEvent() to add a message to the workflow history, but no message is sent. For example I put it in the task changed event; the event fired without showing the workflow comment. I click Claim Task on the task form which triggers this task changed event.

Any help greatly appreciated, thanks.

Was it helpful?

Solution

SPWorkflow.CreateHistoryEvent() works fine. The problem was, I was using it in an onTaskChanged event that was not getting hit. Specifically, my workflow had two tasks and two of these task-changed methods. I was simply putting my code in the wrong event.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top