In K2, we have function to move task to any step. We can move task in 3 ways.
First way, is using K2 Management Site or K2 Workspace (in K2 blackpearl). We can click “Go To Activity” button in workflow management. After we click “Go To Activity” button, K2 will list step to move task to.
Second way, we can use API.
Third way, K2 have SmartObject (just have in K2 Five. If we use K2 blackpearl, we need to create Endpoint Assembly or Endpoint Werservice to link to dll or web service that we created). GoToActivity Service Object can found at K2 Management => Workflow => Management => Management Service. Then you can create SmartObject from that Service Object.
For second and third way, parameter that we’ll use 2 parameters. Process Instance ID of process that we want to move task and name of step that we want to move task to.
The function usage seem to be simple. Just input id of workflow instance and step to move to. So we’ll try it out.
First step, open workflow to see name of step.
We’ll try to move task to step “Manager Approval”.
But we got error step not found. Why this happen???
Source of Problem
If we see the name of step in workflow, K2 keep 2 type of name — System Name and Display Name.
If we use old version of workflow (in K2 blackpearl), we’ll not found this problem because tool (K2 Studio and K2 for Visual Studio) will force us to input unique name of step in each workflow. But in K2 Five, you can use same name of stop in workflow. This name was Display Name in database.
We have 2 ways to see System Name of workflow step — see in database and see through SmartObject. In this blog, we’ll use SmartObject way.
First step, we need to find “Process” SmartObject (You can find in All SmartObjects category that will be in the buttom of SmartObjects Service Tester tool). Select method “List” and search for your workflow. We need to remember “ProcID” to use. If you deploy workflow multiple times, you will have more than one version of workflow so please use “ProcID” of the correct version.
Next step is finding “Activity” SmartObject (you can find in All SmartObjects same as Process SmartObject). Input “ProcID” that we got from Process SmartObject. We’ll see System Name and Display Name of step in workflow.
We’ll use System Name to use in Go To Activity. “Manager Approval” have system name as “Task”.
Finally, we can use Go To Activity as expected :)