GetProcessInstance( ) throwing 'Process instance not found' exception

  • 2 November 2007
  • 2 replies
  • 3 views

Badge +1

We are using SourceCode.Workflow.Management.WorkflowManagementServer.GetWorklistItems(new DateTime(1900, 01, 01), DateTime.Now, "", "", "", "", ""); to get a list of *all* WorklistItems for a workflow, which we then want to filter and build a list of 'current' or 'open' WorklistItems from.


An important function of the filtering process is to look at datafield values on the process instance. We hope to do this by opening a connection to port 5252 and using SourceCode.Workflow.Client.Connection.GetProcessInstance(WorkflowManagementServer.ProcInstId) to return a SourceCode.Workflow.Client.ProcessInstance, which can then be interrogated for proper value(s). 


[Important note: Since SourceCode.Workflow.Management.WorklistItem does not look like SourceCode.Workflow.Client.WorklistItem, and it doesn't have same 'business' instance data SourceCode.Workflow.Client.WorklistItem has, we are also needing for business reasons to build lists of SourceCode.Workflow.Client.WorklistItems with SourceCode.Workflow.Management.WorklistItem as the 'driver'.]


The problem is SourceCode.Workflow.Client.Connection.GetProcessInstance(WorkflowManagementServer.ProcInstId) throws an exception that the 'Process instance is not found'. I know this not to be the case as I can see the process instance via a custom report and can see it in the Workspace. Any ideas why GetProcessInstance() is not working? What is best way to debug our issue?


TIA,


Curtis


2 replies

Badge +9
Just a thought... does the identity for the code that invokes GetProcessInstance() have rights within the K2 process.  Specifically is it a process level Admin?  This can be set on the process level within Workspace Management Console.  Please note, this is not the same as a Server Admin.
Badge +1

Good thought. User [account] invoking code has admin rights but did not have proper permissions to workflow(s) it was trying to retrieve process instance for. We're still getting 'not found' exceptions after setting permissions [despite server reset, etc.]. Thanks for your help, and good catch.


 Curtis  

Reply