# Pass the execution to a ServiceTask (CMMN)

**URL:** https://forum.flowable.org/t/pass-the-execution-to-a-servicetask-cmmn/7277
**Category:** Uncategorized
**Created:** [January 7, 2021, 1:55pm UTC](https://forum.flowable.org/t/pass-the-execution-to-a-servicetask-cmmn/7277 "2021-01-07T13:55:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![komates](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@komates](https://forum.flowable.org/u/komates)
#### Post date: [January 7, 2021, 1:55pm UTC](https://forum.flowable.org/t/pass-the-execution-to-a-servicetask-cmmn/7277/1 "2021-01-07T13:55:48Z")

</div>

Hello,

The documentation states you can inject the execution as parameter of a ServiceTask: [BPMN 2.0 Constructs · Flowable Open Source Documentation](https://flowable.com/open-source/docs/bpmn/ch07b-BPMN-Constructs/#java-service-task)

```
<serviceTask id="javaService"
         name="My Java Service Task"
         flowable:expression="#{printer.printMessage(execution, myVar)}" />

```

It works well for BPMN but when it comes to CMMN, it throws an exception:

> Cannot resolve identifier ‘execution’

Any idea how to inject the execution in CMMN?

Note: I prefer to use method on bean rather than implementing JavaDelegate because you can pass argument without using an intermediary variable

Thank you  
Regards

---

<div class="post-metadata">

### Author: ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)
#### Post date: [January 7, 2021, 2:00pm UTC](https://forum.flowable.org/t/pass-the-execution-to-a-servicetask-cmmn/7277/2 "2021-01-07T14:00:27Z")

</div>

CMMN does not have an execution. However, you can inject `planItemInstance` or `caseInstance` into it.

> [@komates](#):
>
> Note: I prefer to use method on bean rather than implementing JavaDelegate because you can pass argument without using an intermediary variable

That’s possible, e.g. use `DelegatePlanItemInstance` as parameter.

---

<div class="post-metadata">

### Author: ![komates](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@komates](https://forum.flowable.org/u/komates)
#### Post date: [January 7, 2021, 2:13pm UTC](https://forum.flowable.org/t/pass-the-execution-to-a-servicetask-cmmn/7277/3 "2021-01-07T14:13:53Z")

</div>

It works 😉

Thank you for your answer.
