Default Client Event

  • 4 August 2005
  • 7 replies
  • 0 views

Badge +1
Dear Users

I'm new with K2 and have a question. I created a workflow with the K2 Studio. In the first Activity, a user has to approve or decline the next step.

I start the workflow with a webform and a button:

string name = TextBox1.Text;
string surname = TextBox2.Text;
string username = TextBox3.Text;
bool pharma = CheckBox1.Checked;
Connection connection = new Connection();
connection.Open("pluto");
ProcessInstance instance = connection.CreateProcessInstance("k2trainingCreateMailAccount");

for (int i=0; i<instance.DataFields.Count; i++){
if (instance.DataFields.Name == "name"){
instance.DataFields.Value = name;
}
else if (instance.DataFields.Name == "surname"){
instance.DataFields.Value = surname;
}
else if (instance.DataFields.Name == "username"){
instance.DataFields.Value = username;
}
else if (instance.DataFields.Name == "Pharma"){
instance.DataFields.Value = pharma;
}
}

connection.StartProcessInstance(instance);
connection.Close();

After the start of the workflow, I see in the workspace the process and can go to the webpage I defined in the default client event (internet). On this page I have to buttons: approve and decline. Now I want to continue with the process after the user clicks one of these two buttons. But I get always the error:

Connection to the K2.net server pluto is invalid.

I also created a destination rule in this activity with a mail to the originator. But I never receive this mail.....

Can anyone give me some advice?

thanks in advance

David

7 replies

Badge +9
Hi David,

All looks good in the code you use to start the process instance, can you please post the code you use in your client page, that will help me with trouble shouting your issue.
Badge +1
Hello

In the activity I have a default client event (internet) which points to a k2form I have created in the Visual Studio. There is no source code behind the buttons. I just fill out the properties for the page (solution, process, plan page, ......). The buttons are Finish Buttons. Do I have to write alos some code for these buttons?

regards david
Badge +9
Ok, the only other thing you need to specify is the K2Server Name in the Web.config, have you done that? No additional code is required.
Badge +1
I have already added

<appSettings>
<add key="PlanServer" value="pluto">
...
...

Is this what you mean?
Badge +9
That is what a meant. Replace your K2.net Server Name with the actual IP Address of your K2.net Server and re-test the page.

Please let me know if this helped!
Badge +1
Thanks for your help, but it's still not working.

I start the process, changed to the workspace, the process is active, change to the worklist, click the approve button:

Connection to the K2.net server 145.245.... is invalid.

I tried out diffrent things: If I create the process I use the Connection class with the open method and at the end of the method I call the close method. Do I have to close the connection?

If I create the approve-decline page with a normal web form (not a k2 smart form), which code I have to use to continue the correct process or to connect to the correct process?

Many thanks in advance

regards

David
Badge +11
Hi David,

Just one thing I spotted in one of your posts...
"In the activity I have a default client event (internet) which points to a k2form I have created in the Visual Studio. There is no source code behind the buttons. I just fill out the properties for the page (solution, process, plan page, ......). The buttons are Finish Buttons. Do I have to write alos some code for these buttons?"

The page you are refering to, should be a 'Client Page' and not a 'Plan Page'. Also, you'll need some way of telling K2 exactly which button was pressed - Accept or Decline. I would recommend using a K2RadioButtonList which is linked to a process datafield. This datafield value can then be used later in your process to determine flow direction through Line Rules.

Please have a look in the Help file under References | K2.net 2003 Runtime Objects | Namespaces | SourceCode.K2ROM Namespace | Classes | WorklistItem for an example of how to pick up and complete a worklist item from code. Please note that for a client event, the Serial Number of the Worklist Item is sent together with the client event URL.

If you've got a portal account, I would strongly recommend downloading the training material.

Reply