cancel
Showing results for 
Search instead for 
Did you mean: 

List Task of a Process

lucastdcj
Champ in-the-making
Champ in-the-making
Hi all,

I would like to list all task in a process, more precisely I have one process and the final task is set the result in a website. So if some step is failed in the path I need to set failed in the website and if everything is right i set true in the website. The problem is that when it fail it stop (and I need it) so I don't arrive to the last step which is set the true/false value in the website.

So after:
" ProcessInstance process = runtimeService               .startProcessInstanceByKey("myprocess"); "

I need to check if the bpmn file have the service task "update site" and if the process didn't finish correctly I need to take the properties of the task "update site" and run this task.

So basically I need if the process didn't finish correct:
* List all task of a process to know if "update site" exists
* Take the properties "activiti:field" of this task
* Force the run of this task with this properties

Thank you for your attention,
Lucas
7 REPLIES 7

frederikherema1
Star Contributor
Star Contributor
I suggest you take a look at the JavaDocs of our api, this is quite self-explanatory http://activiti.org/javadocs/index.html

To get you on your way:


// Get tasks
List<Task> remainingTasks = taskService.createTaskQuery().processInstanceId("123456").list();

// Finish task manually
taskService.complete(remainingTasks.get(0), propertiesNeeded);


vire7777
Champ in-the-making
Champ in-the-making
I use this post as it's very close from what i want.
This :
List<Task> remainingTasks = taskService.createTaskQuery().processInstanceId("123456").list();
Just give me the actual Active task, not all the task of my process instance

I've seen somewhere that "HistoricActivityinstances" could give me the complete tasks but how to get the future ones ?

Then, do you know a way to ask all the tasks (completed, active, future) of an process instance ?

Thanks for your time Smiley Happy

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
search the forum better on how to get the future ones… Most likely no other option then to parse the XML

vire7777
Champ in-the-making
Champ in-the-making
Thanks Ronald

So i suppose it exists no way to find All tasks in one action.
I have to search in three times : old, active, futures…

How bad… :'(

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
No, this is not bad. There is a simple reason for this. You can never know for sure upfront which tasks will be actually available in the process instance when it is executing. E.g. gateways can influence this. So what is the usecase of having an overview of all tasks of a process?

jbarrez
Star Contributor
Star Contributor
The 5.11 release will include a parser that returns a pojo model of the xml. You can try it out from master or wait til next week when we release 5.11.

vire7777
Champ in-the-making
Champ in-the-making
Sure, but imagine for example that someone would love more informations about any tasks evenif they could not be played (because the process could take an other way) and just to be informed of any possibility (a manager could love that, to check who would be affected by this or this task). That is what we want.

Anyway, i would wait for next week and the 5.11 release
In all cases thanks a lot for your time Smiley Wink