0

Is there a way to start a SP2010 state machine workflow at a specific state activity?

For example, if I have state A -> B -> C -> D is is possible to start at C?

The idea is I have an workflow that does some stuff and at some point can fail, mainly because of configuration problems or data missing. After I fix the configuration or add the missing data I want to continue from the state it failed at.

How can I do that?

0

It is possible to store the current state (e.g. during State initialization )in a workflow variable and then use the Set State activity as soon as you start and check that value, and act upon it.

Have a look here for more details http://wiki.windowsworkflowfoundation.eu/default.aspx/WF/SetStateActivity.html

Hope it helps, C:\Marius

  • Just some additions to your answer, if I may! Once a workflow fails you can't restart it! You have to cancel it and start a brand new one. Saving something in the Workflow is thus useless so you have to determine the state to jump to based on external factors (which luckily I could). You do that in the worflow activated event (when the new workflow starts) then jump to the desired state with Set State activity. – JohnDoDo May 3 '12 at 9:47
  • You are right about your notes, however, by incorporating strong error handling techniques, instead of failing, you could revert to some default/initial state, which in a State machine workflow could also mean moving to another state, instead of END-ing the WF, as in the case of Sequential WF. – Marius Constantinescu - MVP May 3 '12 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.