1
votes

In our project we are considering WCF Workflow Services, but I am new to WF4. So I wonder if there is a way to query the instances of that service? I would like to get e.g. all workflow instances that are currently waiting for user action at activity "ABC"?

I read about tracking and property promotion, but I wonder if there is a more generic way to query the running instances. I think that tracking/property promotion is something "optional" from a technical perspective, also persisting the instances.

I believe that the workflow host must be able to list the activity an instance is currently in, or am I wrong?

1

1 Answers

0
votes
private  void DumpStateMachine(WorkflowRuntime runtime, Guid instanceID)
    {
        StateMachineWorkflowInstance instance =
               new StateMachineWorkflowInstance(runtime, instanceID);

        Console.WriteLine("Workflow ID: {0}", instanceID);
        Console.WriteLine("Current State: {0}",
                  instance.CurrentStateName);
        Console.WriteLine("Possible Transitions: {0}",
                  instance.PossibleStateTransitions.Count);
        foreach (string name in instance.PossibleStateTransitions)
        {
            Console.WriteLine("\t{0}", name);
            txtNextTransition.Text = name;
            txtNextTransition.Visible = true;


        }
    }