This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
A Workflow moves to a completed status when it is not expected. According to the View Flow, the workflow has not reached the final task and stopped on some preceding activity which has all outgoing lines highlighted in red. Below is a sample View Flow screenshot illustrating a simplified example of this situation:
- The Workflow moves to a completed status when it is not expected
- No error messages are logged
- According to the process design, the workflow should proceed to the next step but it just completes
- View Flow highlights some (not final) of the activity as the last executed one and all lines coming out from it are highlighted in red.
In the described scenario the last activity that executes before the workflow goes into a "Completed" state has both of the lines coming out of it highlighted in red. This means that K2 did not see a way to move forward in any direction and therefore it just completed the workflow. This can happen when you set a Line Rule(s) impossible to meet (or which cannot be met).
For example, when the first line rule has a condition "IF 5 > 10" and the second line rule is set to "IF 10 < 5", then both of those line rules cannot be satisfied (both expressions evaluated as false). Therefore, K2 is unable to move forward using any of those lines and having no other options than to just end the workflow with a Completed state (not into an error state).
In the old K2 Studio Designer, there were no additional design stage checks to prevent such problems, but they were added in the new K2 Five Workflow Designer (there are "badges" that warn you of a loop or line rules that are wrong). But there can also be a scenario where a line rule is configured correctly, but can be evaluated to false.
In this scenario you normally should do the following:
1. Check Line Rules of all the lines that come out of the activity on which your process stopped and check if they can ALWAYS be satisfied. If there is only a slight logical chance that all the line rules cannot be satisfied, then the workflow will just end up in a completed state as described above.
2. Inspect the Events inside of the activity to see if there is something like a SmartObject event that executes a stored procedure in SQL, which gets executed but doesn't do something that is expected from it, or somehow fails without returning an error message to K2. In such scenarios K2 assumes that the event executed successfully, therefore it tries to move the workflow forward, but can't because the line rules conditions are not satisfied, and therefore it just ends the workflow moving it into a Completed state.
3. You can also try to add a separate Activity with a Placeholder event or an Email event that fires when none of the other Activities can be satisfied. In this way, if K2 cannot move forward to any of the next Activities then it will go to this Email Event or Placeholder Event and complete the workflow like that - that could also confirm that the Line Rules were not satisfied.