Worklistitem / Instance not created.

  • 27 November 2007
  • 2 replies
  • 0 views

Badge +4

Hi,


 I am trying to create a workflow that uses Winforms, but despite not receiving any error, neither the process instance nor the worklist item are created.


 I envisage that this would work by looking up data stored at activity level and making the decision what form to open based on that. Below is the code I have in the 'StartProcess' form, would anyone be able to shed any light on my this doesn't seem to work?


 Any help would be much appreciated.


using

System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SourceCode.Workflow.Client;


namespace

K2WinForms


{


public partial class StartProcess : Form


{


private string strK2Server = @"FGL-VSPD-BPL-02";
private string strK2Process = @"K2WinFormsBPProduct";


public StartProcess()


{


InitializeComponent();


}


private void button1_Click(object sender, EventArgs e)


{


Connection oK2Connection = new Connection();
ProcessInstance oNewProcessInstance;


try


{


oK2Connection.Open(strK2Server);


oNewProcessInstance = oK2Connection.CreateProcessInstance(strK2Process);


oNewProcessInstance.DataFields[

"ApprovalStage"].Value = "Business Approval";


oNewProcessInstance.Folio =

"Winforms";


oK2Connection.StartProcessInstance(oNewProcessInstance,

false);


oK2Connection.Close();


MessageBox.Show("Process Created....");


}


catch (Exception ex)


{


MessageBox.Show(ex.Message);


}


}


}


}


Thanks,


 Kevin.


2 replies

Badge +9

Have you tried turning on full tracing by editing the HostServerLogging.config file to set the LogLevel to All and run the HostServer in console mode?  Make sure you run the console as the service account. This might help give some idea if the StartProcessInstance call was made.


     <ApplicationLevelLogSettings>


        <ApplicationLevelLogSetting Scope="Default">


            <LogLocationSettings>


                <LogLocation Name="ConsoleExtension" Active="True" LogLevel="All" />


 

Badge +4

Johnny,


Having turned on logging, I noticed that my ClientEvent.Status went from Started straight to Completed.
I figured that I would change the Default Server Events in my workflow for Default Client Events and this has now resolved my problem.


Thank you for your help.


Kevin.

Reply