How do I loop through a workflow and restart it if there was an error?

  • 4 September 2014
  • 4 replies
  • 10 views

Badge

Is it possible to loop through a workflow and try to restart it if there was an error?


4 replies

Userlevel 3
Badge +9

Depends on what actions you are using.  If you're using actions where you can capture error messages, then you can.  You can use a concept like the one Dan Stoll‌ blogged about in Web Service call fail and retry‌.  You can capture the error then loop through it until their isn't an error.  You could put your entire workflow in the loop, then when it gets to the end if there is an error, it loops through it. 

Badge +6

you might also want to have a look at making your workflow a bit more robust through the use of state machines, described in this blog post here

Badge +16

‌ did you ever resolve this issue?

Userlevel 7
Badge +17

Both Patrick and Brendan have correct approaches and both should be used (Error handling, and State Machines). The advantage State Machines have is the ability to control where a workflow can restart if any issue arises and the workflow must be restarted. Not all actions have error handling capabilities, so tracking the status of the workflow and using the state machine to restart at a known location can help in those scenarios. 

Reply