Skip to main content
Hi,

would anybody tell me how to use K2ROM and KO Objects outside K2 studio, I want to use them in SmartForm or ASP.NET pages, for example, after complex calculation, store data to process. How could i do, which assembly to reference, and some sample code will be perfect!

thanks.
Hi,

Have a look at the K2.net 2003 help file. Expand the tree to References > K2.net 2003 Runtime Objects > Namespaces > SourceCode.K2ROM Namespace > Overview

Here you have access to all the properties and a lot of examples like these:

VB and C# Example
.Value = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString(); 

//Set the Process Folio
oNewProcessInstance.Folio = "My Process Folio";

//PlanStart new Process Instance
oK2Connection.StartProcessInstance(oNewProcessInstance, false);

//Close the Connection
oK2Connection.Close();

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


Add the C:Program FilesK2.net 2003BinK2ROM.DLL as a references in your IIS project. You can also use the Object Browser to have a look at the properties.

The same applies for the KO.DLL

Hope this helps
I m modifying some data fields and once (if) I call the Update() method, the function never returns. At the same time, if I use the K2.NET Service Manager snap-in to delete the process instance, the Service Manager also hangs indefinately.

SourceCode.K2ROM.Connection k2Conn = null;
try {

k2Conn = new Connection(); k2Conn.Open("Serverxx");

SourceCode.K2ROM.ProcessInstance procInst =
k2Conn.OpenProcessInstance(1452);

procInst.XmlFields["ProcessData"].Value = "";

Console.WriteLine("UPdate Started");
procInst.Update();
Console.WriteLine("UPdate Finished");
}
catch(Exception ex) {
Console.WriteLine(ex.ToString()); }finally { k2Conn.Close();
}
Was there any resolution to this problem. I have just posted a similar problem. Update never returns, the status of the process remains as running indefinitely.

I am trying to call the update using the K2ROM dll from a referenced external dll
Update never returns, the status of the process remains as running indefinitely.

I m modifying some data fields and once (if) I call the Update() method, the function never returns

Are you calling the code/assembly that does the datafield update from code in a K2 process, for example a server event? If this is the case, you are most likely running into locking issues - you should not call k2ROM or K2MNG from a process instance.

What is the requirement that leads you to update a process datafield during process execution? Will a async server event not work in this case?

I actually posted a separate reply, and worked out the answer here:


http://forum.k2workflow.com/viewtopic.php?p=6354#6354


Thank you for you quick response. 😃

Reply