Hi,
We have a requirement to enable cancel workflow for the originator through the smart forms so that the originator can cancel the workflow at any point of time. Based on our analysis, we were trying to use the GoToActivity() method as follows :
Â
private void goToActivity(int procinstid, string ActivityName)
{
     System.Diagnostics.EventLog EventLog = new System.Diagnostics.EventLog();
     ((ISupportInitialize)EventLog).BeginInit();
     if (!EventLog.SourceExists("K2 Custom Goto"))
     {
       EventLog.CreateEventSource("K2 Custom Goto", "Application");
     }
     ((ISupportInitialize)EventLog).EndInit();
     EventLog.Source = "K2 Custom Goto";
     EventLog.Log = "Application";
    Â
     if(this.Service.ServiceConfiguration.ServiceAuthentication.AuthenticationMode == AuthenticationMode.ServiceAccount)
       System.Threading.Thread.CurrentPrincipal = null;
     string ConnectionString = this.Service.ServiceConfigurationÂ"ConnectionString"].ToString();
     WorkflowManagementServer wms = new WorkflowManagementServer();
     wms.CreateConnection();
     wms.Connection.Open(ConnectionString);
     EventLog.WriteEntry("Before calling goto in proc id:"+procinstid, EventLogEntryType.Information);
    Â
     wms.GotoActivity(Convert.ToInt32(procinstid),"Finish Workflow");
     EventLog.WriteEntry("After calling goto in procid:" + procinstid, EventLogEntryType.Information);
     wms.Connection.Close();
  }
Â
However, the workflow keeps hanging ( running) at wms.GotoActivity(Convert.ToInt32(procinstid),"Finish Workflow"); . Finish workflow is our end step in the workflow and I have used procinstid directly as well without any use.
Â
We would like to know what we are doing wrong. Any help would be extremely useful as its stopping our production roll out
Â
Regards,
Deb