Shawn
Shawn

Reputation: 123

How to Get Current and Previous Task name in Activiti workflow

We are using Spring Boot and Activiti for process management. How do we get the current and previous task name. We would like to keep track of the tasks.

The response below looked promising though it requires currentTaskId to the details. Not sure how to get the currentTaskId

how to get the previous task name in activiti workflow

Thanks

Upvotes: 1

Views: 2613

Answers (2)

Abbas Kararawala
Abbas Kararawala

Reputation: 1254

To get the current Task name. create a taskQuery like -

delegateExecution.getEngineServices().getTaskService().createTaskQuery().active();

this will give you active tasks.

Do same with historic tasks service for finished() tasks. order them by date and select the last one to complete.

This will help you in getting the delegateExecution - docs

Upvotes: 0

Greg Harley
Greg Harley

Reputation: 3240

Use the Historic Task query and order by completed timestamp. Once you have the task, you can get the associated Activity ID/Name.

Obviously this breaks if you have parallel flow.

Greg

Upvotes: 1

Related Questions