Skip to main content

Hi,


I've created a service that is able to create a process instance, assign data fields and start the process instance.  However, I need to extend this to be able to open a worklist item and complete events within an activity.  I've started the code as follows: 


 The below code does open the process instance and is able to assign values to data fields, but again I need a way to mark an event as complete, more so execute the code within the event.


public void InitializeK2AdminActivities(String SerialNumber, NameValueCollection dataFields)


{


try


{


SourceCode.K2ROM.

Connection c = new SourceCode.K2ROM.Connection();


c.Open(

Utility.AppSettings.K2Server, Utility.AppSettings.K2ConnString);


SourceCode.K2ROM.

WorklistItem pi = c.OpenWorklistItem(SerialNumber, "ASP");


foreach(string s in dataFields.AllKeys)


{


pi.ProcessInstance.DataFieldsSleep.Value = dataFieldsSleep;


}


//Set Event Done....


//pi.EventInstance


pi.Update();


c.Close();


}


catch (Exception ex)


{


throw ex;


}


}

Thanks,


 I have tried pi.Finish() but it didn't seem to execute the code behind the event.  I later found that I forgot to assign some key data fields specific to the event that will allow the code to execute.


Reply