Getting process instance version - best practices?


Badge +5

Hi all,


Here's the scenario... we've added a data field to a process and deployed it. Our ASP.Net application needs to set that data field, but there are live instances of the process which don't have that data field, and obviously the code which sets this data field will cause an exception if it's executed against an older process instance. How do you guys go about dealing with this? I see these options:




  • Catch the exception and deal with the older processes in a different way. It will work but it's very ugly...
  • Keep a process level data field to store the process version and then read from this data field before just assuming the data field is present in all versions.


Any suggestions would be appreciated - thanks guys!


3 replies

Badge +6

I dont think option 2 will work because your old instances does not have a version data field. you will end up doing the option1 i.e., exception handling


another option would be to do Live Instance Migration. There is a sample in the documentation. search for LIM. unless you are very confident, I dont recommend this approach

Badge +8

We do option 2 in all our workflows. The point about the version field not being available is a valid one, but we have made it a habit to put this field in all of our processes and set it in a code activity at the beginning of our workflows.  We have found it works the best and most reliably in all circumstances

Badge +5

Thanks to both of you for your suggestions. In the end I decided that using exceptions would be the best way forward, mainly because in the long term it's the best solution for me. I blogged my solution here: http://www.makingflowwork.com/2012/07/data-fields-and-workflow-versions/


Cheers,


Trent.

Reply