When redirecting, how can I get the process ID

  • 9 February 2004
  • 5 replies
  • 1 view

Badge +3
What I mean is, when I submit the my Smartform with the "Plan" button to start the process, and redirect to a "Thankyou" page, I want to display the new ID that has been created in my thankyou page.

i.e. "For future reference, please quote ID:" + myNewProcessID

How can I get the new ID as soon as it has been created?

Cheers

5 replies

Badge +3
e.g.

this.Label1.Text = Request["sn"];

This returns

ServerName,x,y

I guess 'x' must be the instance number, what does 'y' represent, the process template id?
Badge +3
The Serial Number format is as follows:

{K2ServerName},{ProcInstID},{EventInstID}

where K2ServerName is simply the machine name (or IP) of your K2.net Server. The ProcInstID is the unique process instance ID, and the EventInstID is the unique event instance ID for each destination. That means that if the same Client Event is sent to 2 users, the EventInstID is different.

This is important because this is the mechanism used to check whether a user is attempting to 'intercept' work items.
Badge +8
What is the object.method to get the process instance id?

I am using the following code on the Submit button of the Plan form:

Dim myserveritem as SourceCode.K2Rom.ServerItem
Dim SerialNo as String

SerialNo = MyServerItem.SerialNumber

but I get the error: object reference not set to instance of an object
Badge +7
K2.net provides a serialnumber handle to the event instance through the Internet page URL of the Client Event.

You may simply obtain this serialnumber using the following code:
SerialNo = Request.QueryString("sn")


The above method typically applies only to subsequent approval forms after the the Plan form.

In your case, you could consider using a stored procedure to capture the information submitted by the Plan form into a database table, and have the stored procedure return the @@identity key of the new record. You may then redirect to a "Thank You" page and passing this identity key in the URL to be used as the "reference#" in the "Thank You" page's message.
Badge +8
thanks samuelkoh, that's exactly what i was looking for.
:D

Reply