locked
Accessing Persisted Variables RRS feed

  • Question

  • Hello:

    I'm new to WF. Is there a way access persisted variables from another non-WF application?

    Scenario: A workflow process with many steps, all manipulating process-level variables; one of step in-between is a manual step. I would like to save all the process-level variables (I'm assuming this can be achieved by persistance) before the process hits this manual step.

    A GUI to access the persisted variables and allow users manipulate them. The GUI will also allow users to resume workflow.

    Any feedback on this approach is also welcomed.


    Friday, March 25, 2011 3:51 PM

Answers

All replies

  • Hi Aref,

    First, I would recommend you consider whether you can use workflow Tracking feature to implement this scenario. In this case you are not literally accessing the variable from the persisted workflow data. Instead you are accessing it from a tracking record in a database, which is more like a 'log' of the activity execution. The only problem for your scenario is that Tracking does not allow you to modify the variables.

    If you really need to modify state into the workflow, I would suggest using bookmarks to implement semantics similar to send/receive activity, so that your workflow sends information on its state to the host, and the host replies with 'updates' from users who manipulated the workflow, which will flow in via the bookmark callback parameter.

    Tim

    Monday, March 28, 2011 10:14 PM
  • Actually there is one more possibility.
    You could look at the XMLPersistantStore code in this sample, and use this as a template for creating a custom instance persistance store, where you gain control over the persistance format. And then you can modify the persisted values as you wish.

    Corporate Purchase Process sample.

    Tim

    Monday, March 28, 2011 10:56 PM
  • OK, sorry, today I'm learning as I go... apparently there is an even better way of doing this with the default SQL persistant store: promoted properties in persistance.

    See Andrew's post

    http://xhinker.com/post/WF4Promote-persistence-Data.aspx

    and the MSDN info

    http://msdn.microsoft.com/en-us/library/ee364726.aspx

    Tim

    • Proposed as answer by Tim Lovell-Smith Tuesday, March 29, 2011 12:22 AM
    • Marked as answer by Andrew_Zhu Friday, April 1, 2011 1:16 AM
    Tuesday, March 29, 2011 12:22 AM
  • If you're promoting any complex types or anything bigger than 8K, you'll need to use the varbinary(max) columns. To read that data, you'll need to know how it was serialized. For that, go here: http://social.msdn.microsoft.com/Forums/en-US/windowsworkflowfoundation/thread/bec903b9-5bd5-4b7d-b318-e74bd7a8c748


    Art Schmidt

    Friday, March 1, 2013 10:15 PM