# Get next task name

**URL:** <https://community.ofelia.com/t/get-next-task-name/4814>\
**Category:** Q&A\
**Created:** [3 July 2014 11:44 UTC](https://community.ofelia.com/t/get-next-task-name/4814 "2014-07-03T11:44:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![othmane791](https://avatars.discourse-cdn.com/v4/letter/o/e5b9ba/32.png) [@othmane791](https://community.ofelia.com/u/othmane791)\
**Post date:** [3 July 2014 11:44 UTC](https://community.ofelia.com/t/get-next-task-name/4814/1 "2014-07-03T11:44:48Z")

</div>

Hi, I wanna know how to get the next task(s) name ?

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [4 July 2014 13:36 UTC](https://community.ofelia.com/t/get-next-task-name/4814/2 "2014-07-04T13:36:42Z")

</div>

Can you be more precise ? What is your use case ?

Are they next _human_ task ? Are they any _activity_, whatever their kind ? Are they from the _current_ process, or from _any_ process ? For the _same_ user or for _any_ user ?

Surely you will end up with a list. You will have to go through the process definition to determine what are the available choice.

Getting the next task name means that you need to check all the different alternative from the current task. You may have a set of gateways to go through. First get the current task instance. Retrieve the corresponding task definition. Check on the process definition what are the output from this task definition. Follow the list of possible outputs… etc…

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [20 August 2014 14:45 UTC](https://community.ofelia.com/t/get-next-task-name/4814/3 "2014-08-20T14:45:31Z")

</div>

Hi

In the processAPI, you will find a getDesignProcessDefinition method

from this DesignProcessDefinition class, call getProcessContainer() method returning a FlowElementContainerDefinition

from the latest, call getTransitions(), iterate through this Set and check your current position (current task) to the one returned by the getSource() method. Once you have found Transition, get the Destination

then depending on the complexity of your process you should be able to find your way to the next gateway and then to the next tasks available…

keep me informed!  
cheers,  
RP

---

<div class="post-metadata">

**Author:** ![othmane791](https://avatars.discourse-cdn.com/v4/letter/o/e5b9ba/32.png) [@othmane791](https://community.ofelia.com/u/othmane791)\
**Post date:** [4 July 2014 14:42 UTC](https://community.ofelia.com/t/get-next-task-name/4814/4 "2014-07-04T14:42:21Z")

</div>

in fact I wanna get the next human tasks for an Actor.  
I mean the different human tasks that I could do after a gateway.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [7 July 2014 13:23 UTC](https://community.ofelia.com/t/get-next-task-name/4814/5 "2014-07-07T13:23:05Z")

</div>

a task being finished, you want to display for the current user the list of available tasks ?

---

<div class="post-metadata">

**Author:** ![othmane791](https://avatars.discourse-cdn.com/v4/letter/o/e5b9ba/32.png) [@othmane791](https://community.ofelia.com/u/othmane791)\
**Post date:** [7 July 2014 16:33 UTC](https://community.ofelia.com/t/get-next-task-name/4814/6 "2014-07-07T16:33:44Z")

</div>

No, I want to show to the actual user before his task being finished, the possible next tasks after a gateway.

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [20 August 2014 15:04 UTC](https://community.ofelia.com/t/get-next-task-name/4814/7 "2014-08-20T15:04:01Z")

</div>

The way I did this was to build a database of next tasks, and used that…easier and much less complex than connectors and Java running through…as RP says…

_\> getProcessContainer() method returning a FlowElementContainerDefinition from the latest, call getTransitions(), iterate through this Set and check your current position (current task) to the one returned by the getSource() method. Once you have found Transition, get the Destination then depending on the complexity of your process you should be able to find your way to the next gateway and then to the next tasks available…_
