Skip to main content
I am writing my first K2 Smartform apps. And I have difficulties to intergrate the process data with the ASP.NET web control.

My webform have mix up of K2 web controls and ASP.net controls as well as third party controls.

It is my data submission page, I set the page to "Plan Page", and have a K2 submit button with type set to "PlanButton"

For the K2 controls, I can bind the data to the process by setting the DataField property.

And I have a third party date selector control and I want to let user to select a date from the control and it will integrated to one of the process data field.

So in the OnClick event of the submit button, i have this codes:

.Value = DateControl.Date;

myConnection.StartProcessInstance(myProcessInstance, false);
myConnection.Close();


But when the user click the submit button, 2 process instance is create.
I think it is because the PlanButton will create a process instance by itself and another one is created by my code.

So I changed the button type to "FinishButton", but now when I click the submit button. The page throw a "System Exception: Invalid serialnumber" exception. However I check in the workspace manager, the process instance is successfully created, so what's wrong with my code.

Thanks in advance.
It is because you're mixing Smartform and ASP.NET functionality now. The Finish button expects a serial number (linked to a specific EVENT).

Do one of the following:
1. Change the button back to 'Plan' button and get rid of the code you've generated. Add an invisible K2 Texbox linked to the 'Value Date' data field. When the user selects a date in your date control, set the value of this text box - don't do it in the submit button code.
2. Get rid of the Smartform and do everything in a normal aspx page utilising the K2ROM - as you did in the code generated.

Regards,
Ockert
Ok, I decided to use the normal aspx page.

There are approval step in our workflow, so I have another aspx page to do the approval.

I expected to get the process instance by calling
myConnection.OpenProcessInstance(ProcessID)

But I dont know what the ProcessID is, is the processID included in the sn querystring?



Thanks.
Indeed, the serialnumber is made up of: K2SERVERName, ProcInstID, EventInstID.

Have a look at the samples in the Help file. It would normally be easier to use the whole Serialnumber in a call to OpenWorklistItem(Serialnumber) - but it obviously depends on what exactly it is you're trying to achieve.

Regards,
Ockert

Reply