Question

Problem

I want to get the last task completed for the process instance. I am able to get the last completed human task, but not a Service task.

What i have tried

I have written a SQL query, i am using MySQL, to find out what is last task that is completed. Here it goes :

SELECT * FROM act_hi_taskinst 
where PROC_INST_ID_= '1234' and END_TIME_ IS  NOT NULL
order by END_TIME_ desc;

act_hi_taskinst is the table that gets updated as and when the process instance progresses.

The process flow goes something like this :

A human Task (Leave request) -> Service task( Check availability of leave) -> service task(Check feasibility) -> A human task(Manager task)

When the task comes to Manager Task the last completed is Check feasibility, but its not reflecting in database.

Can you please help

Does activiti provide any such API to get the last completed service task? Can you suggest some SQL query to solve the problem.

Was it helpful?

Solution

The information you are looking for is stored in act_hi_actinst table. It contains information about every activity that’s being executed as part of a process instance.

SELECT * FROM act_hi_actinst WHERE proc_inst_id_ = '1929' 
AND end_time_ IS NOT NULL ORDER BY end_time_ DESC
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top