# disable flowNode / task

**URL:** <https://community.ofelia.com/t/disable-flownode-task/5870>\
**Category:** Q&A\
**Created:** [22 April 2015 14:30 UTC](https://community.ofelia.com/t/disable-flownode-task/5870 "2015-04-22T14:30:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jean-philippe.perrin](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@jean-philippe.perrin](https://community.ofelia.com/u/jean-philippe.perrin)\
**Post date:** [22 April 2015 14:30 UTC](https://community.ofelia.com/t/disable-flownode-task/5870/1 "2015-04-22T14:30:54Z")

</div>

Hello,  
I am new to Bonita and my company ask me to migrate a projet from bonita 5.2 to Bonita 6.5.  
In this projet there are 3 differents lanes with 3 differents actors and many task interact with other actor task. In the old project it seem that, in a human/service task you could cancel or disable a different human task.  
But cant find how to do that in Bonita 6.5. I find in Bonita portal, multiple differents tasks with the same case and processId.  
When I try to use cancelProcessId, it s cancel all the tasks of that processId when I just want to cancel 1 task…

Anyone got a solution on how to cancel/destroy/disable a task from another task with the same processId ?

Thanks you,

---

<div class="post-metadata">

**Author:** ![aleksander.bartnikie](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@aleksander.bartnikie](https://community.ofelia.com/u/aleksander.bartnikie)\
**Post date:** [23 April 2015 10:37 UTC](https://community.ofelia.com/t/disable-flownode-task/5870/2 "2015-04-23T10:37:19Z")

</div>

Hi

There are two ways to go, I guess.

**Do it programatically**  
I’m not sure but this seems to be a good solution:  
  
import org.bonitasoft.engine.bpm.flownode.ActivityInstance;  
import org.bonitasoft.engine.bpm.flownode.ActivityInstanceCriterion;  
import org.bonitasoft.engine.bpm.flownode.ActivityStates

List activites = apiAccessor.getProcessAPI().getOpenActivityInstances(rootProcessInstanceId, 0, Integer.MAX\_VALUE, ActivityInstanceCriterion.NAME\_ASC)  
long taskId = activites.find{ it.displayName == ‘Task name’ }.id  
apiAccessor.getProcessAPI().setActivityStateByName(taskId, ActivityStates.CANCELLED\_STATE)

**Do it in diagram in BPMN style**  
Maybe consider using boundary events, that will interrupt execution of a task when an event from another arrives. Read about events [here](http://documentation.bonitasoft.com/events)

---

<div class="post-metadata">

**Author:** ![jean-philippe.perrin](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@jean-philippe.perrin](https://community.ofelia.com/u/jean-philippe.perrin)\
**Post date:** [23 April 2015 11:54 UTC](https://community.ofelia.com/t/disable-flownode-task/5870/3 "2015-04-23T11:54:53Z")

</div>

Perfect,  
I use the first method, save me from going crazy ^^  
Thank you.
