Symptoms
Suppose the following scenario: You have K2 solution which includes workflow and was in production for some time and there were no issues with this workflow deployments from the very beginning. From time to time enhancements being made into this solution (e.g. smartforms changes, sometimes changes in workflow itself). For workflow related changes you download the process, make changes and redeploy it. It has been working for some time but at some point started to give you the following error upon attempt to deploy a workflow:
The selected state '_STATE_NAME' does not exist on the server.
Run the Smart Forms Workflow Integration wizard to resolve the conflicts.
Diagnoses
Based on error message description we can infer that workflow is integrated with some form which has States and probably makes use of SmatForms Client Event which may give issues similar to this one at times.
In some cases just running Smart Forms Workflow Integration wizard, as suggested in error message, allows you to resolve this issue, but you may see the cases when it does not work. Then it is possible to resolve this by recreating your workflow from scratch relinking all your forms to it.
Best way to avoid similar issues is to refrain from using SmatForms Client Event and use Default Client Event instead. Use of SmatForms Client Event or Smart provides easier way to set up SmartForm integration for beginners but it results in tight coupling between your workflow and smartform. Tight coupling means that both form and process have references to each other and this not in line with best practice of having loose coupling between objects so that parts of your solution are more self-contained and can be easily deployed independently of each other.
With use of Default Client Event you may achieve exactly the same functionality as with SmatForms Client Event but having loose coupling between smartform and process, meaning that your process will only contain smartform URL mentioned and no other hard-coded references to smartform exist within workflow. Moreover, when using Default Client Event to implement SmartForms integration, instead of explicitly specified smartform URL within your process you may use environment variable for your smarfrom which gives you even more flexibility in adjusting your solution without making any changes in your process.
The same is relevant to SmartForms Integration event (can be found under Process Wizards category in K2 Studio).
See Also: "200.YUL - K2 smartforms (Intermediate)" - this K2 learning module covers integration between forms and K2 Studio workflows.
Resolution
When designing K2 solutions try to use Default Client Event for SmartForms integration scenarios as it allows you to achieve loose coupling between smartfroms and process which is commonly accepted best practice for solutions design.