Skip to main content
I am trying to get the full name of the process from within a client event. The property Name is exposed via:

public void Main(ClientEventContext K2)
{
// returns the name of the process
// K2.ProcessInstance.Process.Name;
}

But, I need to get the full name of the process, like ProjectName/ProcessName.

Is there any way to reference another global K2 object, or is there some object that I am not using correctly?

Thanks in advance,

Jesse
Hi Jesse,

'ClientEventContext' is part of the KO object model. As far as I know, there is no way to obtain the Full 'ProjectProcess' name through this object model.

You can however use an external assembly utilizing either K2ROM or K2Mng to get to the required property but both can introduce new difficulties. The required property can be obtained through:
K2Mng.ProcessInstance.ProcSetFullName; or
K2ROM.ProcessInstance.FullName.

Both of these objects will require you to log in as a specific user and depending on your security and/or permission setup, access to the K2.net Server can be restricted. Also, although I haven't tested this, accessing a process instance from within itself through the K2ROM can (but not necessarily will) cause K2.net Server to 'hang' due to record locks in the database - be careful.

Regards,
Ockert
If you want to display the full path on a UI form, you can obtain the full path either using K2ROM as Ockert indicated (K2ROM.ProcessInstance.FullName) or, if you are using a K2.net SmartForm, with a combination of the Project and Process properties of the form which are set at design time, like so:
this.Project + @"" + this.Process;

If you need to obtain the full path in a server event, you can always define a process datafield to store the process' full path and set the datafield's value from K2ROM or a SmartForm when the process is started or at some time during process execution.
Ockert and NeilM,
Thanks for your responses. Currently, I have the full name in a variable in the String Table, but I think putting it in as a datafield may be the best way to go.

I actually considered using the k2rom to pull up an instance of itself to get the full path, but the record locking basically negates all possible benefit. I really appreciate that insight. I dont think I would have come to that conclusion by myself.

Thanks again,

Jesse

Reply