Pregunta

I'm quite new to WF, so I'm a bit puzzled about whether this is even possible, although it seems like it should.

I have this workflow that potentially fails and where I need to access some variables after the workflow fails. My first thought was to use the Completed event, and do some specific work on ActivityInstanceState.Faulted, but I don't know how to access the workflow's variables (or if it is even possible). I kind of get the feeling that I am not supposed to do it this way.

It would be great if you guys could help me out here.

¿Fue útil?

Solución

The completed event has WorkflowApplicationCompletedEventArgs that contains the dictionary of the OutArguments of the workflow instance’s root activity, keyed by argument name.

So you could keep populating the OutArguments as your workflow progresses and when it Completes, access the dictionary and hence the OutArguments.

Setup delegate

WorkflowApplication.Completed = ApplicationCompleted;

Method called on Completed

private void WatcherApplicationCompleted(WorkflowApplicationCompletedEventArgs e)
{
      e.Outputs;  // <---Output dictionary
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top