Search code examples
workflow-foundation-4workflow-foundation

Best way to upgrade existing workflows when renaming custom activities arguments?


We have a custom activity that has an argument (InArgument to be prices) with a bad name.

If I rename the activity argument what it the best way to upgrade existing workflows?

I know an workflow is just Xaml. Should I just count on my string parsing skills?


Solution

  • Renaming in workflow is a pain and often breaks.

    Most reliable way is:

    1. open your workflow
    2. remove all the activities with the misnamed Argument
    3. Edit the Activity
    4. Compile
    5. Add the activities back to the workflow.

    Seems like overkill but short-cuts like editing the xaml tend to break weirdly.

    Bear in mind that once any part of a workflow is changed then already persisted workflows of that type will not load.

    To deal with that you should save the edited xaml as a version in a database or folder. When loading from persistence you need to identify the initial xaml the persisted workflow was created under and load that xaml using the correct version.