I'm working on building a (my first) State Machine workflow in my Dev box. I created the workflow to set some variables and then enter the state machine, there it will assign tasks and switch between states until concluding. All of my states had Change State actions to switch to a new state or to end the state machine - so I don't see anything wrong with the state machine itself that would cause it to error. I also haven't changed the name of the state machine, which I hear can break it as well.
Unfortunately, my workflow would error every time it reached the state machine. So I read up on the issue and found two things:
1. Disable Safe Looping - to my understanding in production this is a valid option as well as long as you disable, publish and then re-enable.
2. Something about a timer service? I'm assuming the Timer Job that everyone refers to is the Nintex Workflow Scheduler(NWFS), but no one actually says which timer job they're referring to or what to do to it to get State Machine's to work... My NWFS is set to 5 minutes.
In trying to get this State Machine to work I created a second test list and made it go straight to a state machine, it failed as well. I disabled Safe Looping and performed an IIS Reset, then republished the WF. Now the new state machine worked accordingly.
I went back to my original workflow and republished - still failing. I deleted the state machine action and made a very simple state machine - still failing. I deleted the state machine and tried again, just setting variables - workflow runs fine. So I thought, "Maybe I've corrupted the list or something?" So I created a new list based off the same content type, new workflow, set my variables, try to enter a simple state machine -fail. (So is there something wrong with my content type? I'm only asking for simple fields, text, choice, user - nothing complex like a managed metadata field, lookup or calculated...)
When I create a new item (start the workflow) it sits in "In Progress" for some time before changing to "Failed on Start (retrying)." I have enabled verbose logging on the workflow and when I look at the workflow history it shows my beginning actions highlighted in green (even though it does not perform those actions - logging to history and setting variables) and the State Machine highlighted yellow. My ULS logs don't show anything until the workflow actually aborts, and then it just indicates "Legacy Workflow Infrastructure - Unexpected - System.Threading.ThreadAbortException: Thread was being aborted...."
Solved! Go to Solution.
At last! I reread this post and caught on to what Fernando Nunes said about restarting the Timer Service. I kept fiddling with the Nintex Workflow Scheduler, but the Timer Service itself was the problem!
You can restart the service either through CMD or via GUI:
GUI: Start > Administrative Tools > Services > SharePoint Timer Service > Restart the service
net stop SPTimerV4
net start SPTimerV4
Thanks for following up with your question! In addition to the post that helped you I recommend you review the following post as well regarding the Workflow timer job: Workflows not continuing - Timer Service and Delays