EPiServer uses the standard SqlWorkflowPersistenceService which stores the System.Workflow.Runtime.WorkflowInstance instance in the database in a binary serialized format. In addition to this EPiServer stores some metadata (instances of EPiServer.WorkflowFoundation.WorkflowDefinitionInstance) about running instances in the database (in ObjectStore). This metadata contains e.g. an history list related to the running instance. This is what RequestForFeedback uses to store feedback. But when the workflow is either completed or terminated both the workflow instance and the metadata is destroyed.
If you would like to persist the HistoryData even after the workflow instance is gone you could hookup to WorkflowSystem.WorkflowManager.WorkflowCompleted and WorkflowSystem.WorkflowManager.WorkflowTerminated and in those event handlers call WorkflowSystem.WorkflowMangager.GetInstance to get the metadata for the instance (metadata is still available in these events). Then you could get the History list for the instance and store it persistent somewhere (e.g. DDS). The reason you have to hookup to WorkflowTerminated event is that if the owner of the RequestForFeedback instance chooses to complete it before time has elapsed then a terminate request is sent to runtime. In that case the exception message in WorkflowTerminated event will be "owner request".
Thanks for the response, Johan.
However, where would I bind that event handler? I've tried:
Try as I might, I can't get the event handler to bind. I run a workflow, complete it, and my event handler does not fire.
It just occured to me that I may be totally missing the point here -- do workflows even execute in the same space as the Web project? It strikes me that they probably execute in their own aynschronous thread somewhere, which means my attempt at event binding is pointless.
So, I'm back to the same question: where do I bind this event handler?
It should not matter where you connect your event handler (the first call to WorkflowSystem.WorkflowManager sets up the singleton instance). Workflow instances are running on background threads but in the web site appdomain so event handlers should be called. You could try to turn on log4net logging (level=All) for the namespace EPiServer.WorkflowFoundation then you will se logentries when worklow instances are e.g. completed or terminated. The log outputs are written in the same context (method) where events are fired so if you see log outputs you should have events raised as well.
When someone initiates a workflow, and it requires users to input data, where does that data go?
For instance, if I initiate a Request for Feedback workflow and send it to 10 people, those 10 people have to type something in the feedback box. Where does that data live?
My client wants to persist that. They want to be able to look back and see what feedback was provided each time this item was sent through workflow. So, they want some historical record of the workflow -- who it went to, what feedback was provided, etc. They want something like another tab on the Edit Panel for "Workflow History," where they can browse this information a year later or whatever.