I could not find a clear explanation on K2 Knowledge Center, how workflow versioning works in the new designer (K2 Five and/or K2 Cloud). I still receive some questions from my colleagues, therefore, I find it helpful to create a short article and explain all the details. However, you need to understand, that everything was tested on K2 Cloud Update 7 and K2 Five 5.2. K2 might change the behavior, which will make the following article invalid. So let’s go.
What happens when I create a workflow?
If you created a new workflow and have not clicked Deploy button, your workflow exists only in Designer mode. What does this mean and how you can tell this:
- if you delete your workflow it WILL BE DELETED COMPLETELY;
- the version format of your workflow is 0.0.0.X, where X is the number of your designer version, that will change every time you change the process definition.
What happens after I deploy the workflow?
When you hit the Deploy button, your workflow will be deployed to the Server and it will kind of exist in 2 places:
- Designer Version – the version, which you keep on changing and modifying;
- Deployed Version – a certain version of your workflow definition, which you sent to the Server, and that is used by K2 when process instances are started.
What does this mean:
- If you delete your workflow in K2 Designer, it will only delete the Designer Version and the Deployed Version will remain untouched.
- the version number of your workflow will now change to X.0.0.Y, where X is the number of your deployed version and Y is the number of your designer version, which will again start from 1.
How can I revert back to the latest Deployed Version?
You need to make sure that your workflow was really deployed. You can tell this, by checking the first number, which should be more than 0. Afterwards, you need to delete the Workflow from Designer. As soon as you do this, you will still be able to see the workflow in your category browser section, however the icon will change a bit and you will see a small arrow in the right bottom corner:
And also the Version of the workflow will contain only first 2 numbers:
This means that you see the DEPLOYED DEFAULT version and the designer version does not exist. As soon as you open this workflow:
- K2 will create a Designer Version of the LATEST DEPLOYED version (not the default one!);
- the version will again contain 4 numbers;
- the designer version number will start again from 1.
How can I delete workflow from K2 Server completely?
You need to delete the workflow from K2 Designer and also all the deployed versions from K2 Management. This will remove your workflow completely.
How can I revert back to the previously deployed version?
As I have already mentioned before, as soon as you delete the workflow from K2 Designer, you will still be able to see the DEPLOYED DEFAULT version. However, if you open it, K2 will open the LATEST DEPLOYED version. What it means is that, if you have 5 deployed versions, but would like to open and modify Version 3, all you have to do is the following:
- Delete the workflow from K2 Designer.
- Change the default version in K2 Management studio to Version 3.
- Delete Version 4 and Version 5 in K2 Management.
- Open K2 Designer and open the workflow.
K2 will create a copy of the LATEST DEPLOYED version, but not the latest default one!
Please, check this on the following screenshot – 3.0 vs 3.0 (Default):
And after you open it – 126.96.36.199 vs 3.0 (Default):
Please, pay your attention, that this post is purely based on my experience. I do not know the technical side and only described, what I got when clicking around or better to say – using an empirical approach. But I still hope that now you got the idea, how K2 workflow versioning works in the new K2 Designer.