Task Name and Goto Activity in K2 Five

  • 26 July 2019
  • 2 replies

Original post from my blog here - https://medium.com/k2-dev-en/task-name-and-goto-activity-in-k2-five-91c7dcf9d2bc 


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.


                                                 Go To Activity in K2 Management Site


                                                       Step to select in Go To Activity


Second way, we can use API.


                             Coding reference from https://help.k2.com/support-services/kbt154330


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.


                                                              K2 Management Service Type


                                                                    Go To Activity 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.


                                                         Go To Activity Parameters


The Problem

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.


                                                                             Workflow Design


We’ll try to move task to step “Manager Approval”.


                                                                 Error Activity Not Found


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.


                                                                  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 step 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.


                                                                      Process SmartObject


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”.


                                                                Go To Activity Complete


Finally, we can use Go To Activity as expected :)

2 replies

Can we change the System Name in the workflow? If so, how can we do that?

Userlevel 3
Badge +6
Hi @patto_kung 
You can see the system name and display name of Task with the Process Version Migration Utility: https://community.k2.com/t5/K2-blackpearl/Process-Version-Migration-Utility-v3-0-6/ba-p/98975
It's not possible to change the system a name.

Warning:  we have encountered a problem with GoToActivity (K2 Five 5.1 to 5.4 at least)
Following the use of the go to activity inside a Split/Merge the workflow stops at the “Merge” step next. Issue appears with Go To Activity from Management site with K2 Five new designer (Split and merge was not possible in K2 Studio).
The issue appears too with Process Version Migration Utility: https://community.k2.com/t5/K2-blackpearl/Process-Version-Migration-Utility-v3-0-6/ba-p/98975
At the same time, I asked to an impacted customer to create 2 K2 Ideas created in order to maximize the chances of having actions taken on this subject which can be blocking.
I therefore invite you to vote on these K2 ideas:
Fix issue: after go to activity, the workflow stop at the next merge step.
Add warning message in case of use of Go to activity from Management site to avoid important issue with split branches.
Please vote on them and don't hesitate to transfer to your colleagues who have a K2 account: For a K2 Idea to possibly be considered, you need at least 20 votes.

In addition, a normal behavior to know is the following:
If there are several activities in progress on the same instance of worklfow and that one uses the GoToActivity on any activity,
all the activities are finished and it does not will remain more than that specified by the Go To Activity.
However, it is possible to do a Go To Activity for a specific activity via the API.
This functionality has been implemented in the Workflow Management: https://community.k2.com/t5/K2-blackpearl/WorkflowManagement-Service/ba-p/65416
With this tool, we have possiblity to specifiy the "FromActivityName".
SmartObject service tester++ URL (https://community.k2.com/t5/General-K2-Utilities/SmartObject-Service-Tester-plus-plus/ba-p/92426):
SmartObject ExplorerDefaultSmoTask_managementMethodsGotoActivity -E ProcInstID=123;FromActivityName=Task1;ActivityName=Task3
Best regards,