# Suspending process instance not suspending service tasks and user tasks

**URL:** <https://forum.flowable.org/t/suspending-process-instance-not-suspending-service-tasks-and-user-tasks/10714>\
**Category:** Flowable Engine\
**Created:** [July 28, 2023, 6:10am UTC](https://forum.flowable.org/t/suspending-process-instance-not-suspending-service-tasks-and-user-tasks/10714 "2023-07-28T06:10:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kicha](https://avatars.discourse-cdn.com/v4/letter/k/91b2a8/32.png) [@kicha](https://forum.flowable.org/u/kicha)\
**Post date:** [July 28, 2023, 6:10am UTC](https://forum.flowable.org/t/suspending-process-instance-not-suspending-service-tasks-and-user-tasks/10714/1 "2023-07-28T06:10:47Z")

</div>

Our usecase is need to invoke custom service(another simple BPM for performing some business checks) before every service task bigin. So we are trying to implement the flow such that  
start → User Task → Start task (here added execution listener[event=‘start’] to suspend current process and trigger child process) → Another service task(same child process as previous task) → end.

When we suspend the current process instance in execution listener, process goes to suspension\_state, but tasks are still in active state. After child process completion, when we try to activate suspended process, getting below error.

> Cannot set suspension state ‘active’ for task … ’: already in state ‘active’.

PS: Child process flow is  
start → service task → end (here added execution listener[event=‘end’] to resume parent process)

Suspend using API

> _CommandContextUtil.getProcessEngineConfiguration().getRuntimeService().suspendProcessInstanceById(execution.getProcessInstanceId());_

Process activation using below API

> _CommandContextUtil.getProcessEngineConfiguration().getRuntimeService().activateProcessInstanceById(execution.getVariable(“parentProcessInstanceId”).toString())_

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [July 28, 2023, 6:57am UTC](https://forum.flowable.org/t/suspending-process-instance-not-suspending-service-tasks-and-user-tasks/10714/2 "2023-07-28T06:57:48Z")

</div>

Hi.  
Why do you want to suspend parent process?

Martin

---

<div class="post-metadata">

**Author:** ![kicha](https://avatars.discourse-cdn.com/v4/letter/k/91b2a8/32.png) [@kicha](https://forum.flowable.org/u/kicha)\
**Post date:** [July 28, 2023, 7:11am UTC](https://forum.flowable.org/t/suspending-process-instance-not-suspending-service-tasks-and-user-tasks/10714/3 "2023-07-28T07:11:01Z")

</div>

Hi Martin, thank you for the reply.  
Child process performing some business rules and send back the result to parent process. Based on that next task will get executed and invoke same child process to prepare business data for next task and so on.

We are bit new to flowable. So if there is any other alternatives, we are open to change the flow model.

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [July 28, 2023, 9:36am UTC](https://forum.flowable.org/t/suspending-process-instance-not-suspending-service-tasks-and-user-tasks/10714/4 "2023-07-28T09:36:30Z")

</div>

From my point of view there is no need to suspend the process.  
(Do you suspend java thread when you call the method?)

Regards  
Martin
