Skip to main content
Hi everybody,

I am facing a problem using K2.My problem is that I want to access datafields of any process from my web application developed in ASP.NET 2003 ie I want to access datafields of any process from my codebehind.If anybody has any idea please help me.

Thank you
mrsayantandutta,

I found this code in the K2ROM API documentation available online through the portal or in your K2 installation folder under Help. Both VB.net and C# examples are available. I've only included the C# example here. I've also cut out part of the example to simplify the code. The full example in the API documentation includes writing to XML datafields as well.

Datafields and XML values are read / write using the K2ROM.

.Value = "DATA_TO_WRITE"; 
//////////////////////////////////////////////////////////////////


//K2.net 2003 can update the changes made to the Process Instance
oServerItem.Update();
//OR
//K2.net 2003 can update the changes made to the Process Instance and then continue with the Process after completing the Event
oServerItem.Finish();

//Close the Connection
oK2Connection.Close();

}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}


The Connection object has overloaded the Open method and as such can be used in one of the following ways...

oK2Connection.Open(K2Server); 

OR

 
//strCon = Domain,User,Password
oK2Connection.Open(K2Server,strCon);


Hope that helps.

sherif
Thanks a lot.I am trying to implement it.
Hi Guys,

The code sample is correct; however I need to mention that this will only work if one has a Server Item and the corresponding Serial Number.

A couple of things:

1. The page you want to use to access Process Data, is this page associated with a Client event?

If Yes:
Have a look at the K2ROM object model documentation, reference the Worklist Item object

2. How will you determine what process to open? The K2ROM object contains an OpenProcess method (part of the Connection object) if you have the ProcInstID you can open any process with this method provided the process is still running. This can also be dangerous cause if a workflow participant is busy working on a worklist item and the data gets changed in the background the user will have no idea that the data was changed, this can cause some inconsistency around decisions made that relies on accurate data.

K2ROM object documentation contains samples of everything needed.

Reply