get Process Instance ID From SmartForm

  • 5 September 2005
  • 1 reply
  • 1 view

Badge +1
Hi All,

Could anybody show me how to get the process instance ID from the smartform, or somehow get the reference to the ProcessInstance class.

Regards

Viet

1 reply

Badge +2
Hi Viet

You can use the K2ROM to get the processinstance ID from an existing process instance. You'll notice that the K2 serial number is passed as a parameter when opening an ASPX form.

The code to get the ProcessInstance ID would look something like this (pseudo-ish code):

Sub Page Load Event
If not IsPostBack
dim myK2Conn as new SourceCode.K2ROM.Connection
dim myWorkListItem as SourceCode.K2ROM.WorkListItem
dim SerialNumber as string = request("sn")
myconn.open(K2ServerName)
myWorkListItem = myK2Connection.OpenWorklistItem(SerialNumber, "ASP")
dim myProcessInstance as SourceCode.K2ROM.ProcessInstance = myWorkListItem.ProcessInstance
dim ProcessInstanceID as string = myProcessInstance.ID
end if
end sub
Unfortunately there is, to my knowledge, no way to get a ProcessInstanceID from a PlanPage, but I'm open to being corrected on this. You would thus only be able to use the above code on an existing process instance.

Good Luck

Dirk

Reply