Skip to main content

Is it possible somehow in the API to retry all errored out processes through a windows service or something?  I have looked through the documentation for some way to do this and i found nothing.  Any help is appreciated.


Thanks

Hi,


Yes this should be possible using the SourceCode.Workflow.Management API.


Here is theoretically how you will be able to do so (Please note that I haven't tested the code so use it as an example only):


WorkflowManagementServer ManagementServer = new WorkflowManagementServer();
ErrorProfile profile = ManagementServer.GetErrorProfile("All");
ErrorLogs logs = ManagementServer.GetErrorLogs(profile.ID);
foreach (ErrorLog error in logs)
{
 ManagementServer.RetryError(error.ProcInstID, error.ID, "DenallixAdministrator");
}


For more information on this API see the following section in your K2 blackpearl Documentation: Developer Reference > Processes > Managing > About Managing Processes


Hope this helps!


Johan has the right idea.


Consider this:  anything you see in K2 Workspace is implemented using the K2 API.  Therefore if you can do it in workspace, you can do it using the API.  Most of the things you see in workspace would fall under the SourceCode.Workflow.Management or SourceCode.Workflow.Client APIs.


Perfect, just needed a couple more lines of code and this did the trick.  Thanks a lot.


Hi I am new to the K2 .I created a work flow ,i can see in the Management console .


I can't see in the process overview.


Please help


Hi sujatha,


To view the Process Overview report the user you are logged in with needs at least View or View Participate rights on the process.


Give your account View rights to the process. This should resolve the problem.


Regards,


I have another question.


I am trying to acess Process/Activity dataFields From WorkFlowAManagementServer,how to do it.......


SourceCode.Workflow.Management.ProcessDataFields datafields = workflowMangementServer.GetProcessDataFields(listItems[0].ProcInstID);


            foreach (SourceCode.Workflow.Management.ProcessDataField ProcessDataF in datafields)
            {
                string repname=ProcessDataF


            }


 


does not work


Hi,


To be honest I don't think you can do this through the Management API. The GetProcessDataFields method is only used when you start a new instance to allow you to populate the data fields with values when a new instance is started. You cannot access or modify the data fields of a running instance.


For this you have to use the SourceCode.Workflow.Client API. I suggest that you use the ImpersonateUser method, impersonate a user which is currently the destination, open the item withou allocating it, change the data fields, and then call the ProcessInstance.Update() method to update the data field values.


Hope this helps!


Reply