none
Get Current Workflow State and Next Possible Actions

    Domanda

  • Hi All,

    I am developing a WF 4.0 Workflow
    Service with a State Machine for modeling an Order Lifecycle Workflow. In WF
    3.x with tracking service, it was possible to get access to the workflow
    instance and query current state and possible actions you could take. Is there
    a way to do the same in a WF 4.0 Workflow Service ( .xamlx )? From what I’ve
    seen if you do self-host probably using the WorkflowApplication API you could
    query this info but as Workflow Service I have no idea how to do this. I wanted
    to use a Workflow Service instead of self-hosting workflow because I want to
    use AppFabric.

    Thanks in advance.

    Best Regards,




    mercoledì 22 febbraio 2012 23:58

Risposte

  • There is no built in way to do this, however using tracking it might be possible to work it out.  Whenever a state machine transitions state it issues a StateMachineStateRecord so you can know what the current state is.  As for the set of possible transitions for that you would have to come up with some way of analyzing the workflow to know where it could go.


    Sr. Program Manager, Windows Azure Platform Team(WF) http://blogs.msdn.com/rjacobs http://www.twitter.com/ronljacobs

    giovedì 23 febbraio 2012 19:33

Tutte le risposte

  • There is no built in way to do this, however using tracking it might be possible to work it out.  Whenever a state machine transitions state it issues a StateMachineStateRecord so you can know what the current state is.  As for the set of possible transitions for that you would have to come up with some way of analyzing the workflow to know where it could go.


    Sr. Program Manager, Windows Azure Platform Team(WF) http://blogs.msdn.com/rjacobs http://www.twitter.com/ronljacobs

    giovedì 23 febbraio 2012 19:33
  • IMO, this a a big HOLE in the current imlementation of WF4.  Theres no possibly way of doing a "Human Task" type Workflow without digging into the innerds of the Engine to figure a way to present current state, next states to a front-end user.

    The only other option is to re-create the State Machine outside of the Workflow Engine and sycronize the two.  This seems to be how the "Human Workflow" example did it : http://msdn.microsoft.com/en-us/library/ee622985.aspx.

    Ron,  I was just going over your Worklfow sample called "Security Door" with the front end being done in Silverlight.  A nice addition would be to use Database Workflow persistance + Tracking and be able to come back into the application, type in a room # and it remembers its current state, such as the door is still open.

    domenica 26 febbraio 2012 22:06
  • I agree with you, It's a grand missing functionallity.

    I tried looking for the "Human Workflow" example, but the link is down, can you explain to me a little more about this? or post the corrected link?

    Thanks!

    venerdì 9 marzo 2012 19:13
  • We use bookmarks. This will tell us what the states  that you can move to. And from that you can figure out what state you are currently on.

    In Trigger set a bookmark for each state and then call

    instance.GetBookmarks()

    martedì 13 marzo 2012 04:28