Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
    
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. –  C. Marius - MVP May 3 '12 at 14:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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