Skip to main content

Hi everyone. 


I have read that K2 internally all data related to the processes deployed in a physical database (usually SQL server). Each and every process and activity is given a unique ID (which is different from the Instance IDs). All the reports like Process Overview make use of these tables and refer these processes by their unique IDs. 


1. Could anyone please confirm if my understanding on this subject is correct?


2. How can I access the tables and the fields in my development projects?


Any help would be highly appreciated.


Thanks


Ankur

Your understanding is correct - the K2Server database contains all of that information for current activities while the K2Log database contains historical data.


What sort of information are you looking to get to? 


I am looking to capture the Process IDs and the Activity IDs as stored in the K2 Server Database. Can I retrieve these values with some syntax like:


K2.ProcessInstance.ID (this gives instance ID, I want the Process ID maintained internally)


Thanks


Ankur


Hi,

Yes, process consists of Process Definition, Process Version and Process Instances. A process instance is based on a Process Version and a Process Version is based on a Process Definition.

A simple example would be that you deploy a process with the name "MyProcess" then this will create the Process Definition for "MyProcess" and a Process Version because this is the first version you deploy. Then if you start a instance of the process a Process Instance will get created based on Process Version 1. The if you make changes to the process and redeploy, a second version will be created of the Process Definition that has all your changes made to the process. And if you start a instance again it will start against the Process Version 2. The default process version is always the latest one deployed. You can change the version to start in your K2 Workspace under Management Console.


using m = SourceCode.Workflow.Management;
using h = SourceCode.Hosting.Client.BaseAPI;

private void button1_Click(object sender, EventArgs e)
        {


            h.SCConnectionStringBuilder scConn = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();


            scConn.Host = "LocalHost";
            scConn.Port = 5555;
            scConn.Integrated = true;
            scConn.IsPrimaryLogin = true;


            m.WorkflowManagementServer wms = new SourceCode.Workflow.Management.WorkflowManagementServer();


            wms.Open(scConn.ToString());
           
            m.ProcessInstances pi = wms.GetProcessInstances("test");


            foreach (m.ProcessInstance var in pi)
            {


                Console.WriteLine(var.Name.ToString());

            }
            wms.Connection.Close();


        }


This is just a simple example to return all process instances with a folio of "test".


hth,


Hi Wessel,


Thanks for your code. We are looking for the Process ID and Activity ID fields. These data are maintained in K2 database in K2 2003. We need to figure out how we can get this data in Blackpearl. We are able to get process instance IDs by using 'K2.processInstance.ID'. similarly we need to get the Process ID and Activity ID.


Thanks,


Gomathi


 


 


Do you want to migrate your Processes from K2.net 2003 db's to K2 blackpearl db's?

You won't be able to do that manually.

What region are you? You need to get into contact with one of your local K2 consultants to get the K2 Migration Utility that would migrate your K2.net 2003 process along with all the data to k2 blackpearl db's.


Reply