AnsweredAssumed Answered

RuntimeService API returning NULL

Question asked by gurusri on Sep 29, 2015
Latest reply on Oct 6, 2015 by jbarrez
1)For any workflow in Activiti that are running for a longer time, I would like to find the runtime details of the flow like what task has been completed so far and the status of the workflow.

For that I want to know the process instance ids of all the running flows. I tried using RuntimeService API but the RuntimeService is returning me a null upon querying from it. All the database tables that are provided are getting updated only at the end of the workflow.

The runtime tables in the database are not getting updated when a flow is running. It is updated only for user tasks and receive message tasks and not for service tasks.

Using RepositoryService API I am able to fetch only the process definition id and deployment id.

I tried the following code,

ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(_deploymentID).list().get(0);

ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition.getId());

List<ProcessInstance> pil = piq.list();
(it is returning an empty List)

Is there any possible ways that I could check the status of my workflow?

I am using Activiti 5.9.9

2)For any workflow, I also need to get the task level details, for example task start time, end time etc when the workflow reaches the end node and before it ends.
So I would like to hear from you on how to go about these use cases.