# Unable to get currentFlowElement for an execution

**URL:** <https://forum.flowable.org/t/unable-to-get-currentflowelement-for-an-execution/5964>\
**Category:** Flowable Engine\
**Created:** [May 5, 2020, 1:28pm UTC](https://forum.flowable.org/t/unable-to-get-currentflowelement-for-an-execution/5964 "2020-05-05T13:28:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [May 6, 2020, 8:08am UTC](https://forum.flowable.org/t/unable-to-get-currentflowelement-for-an-execution/5964/2 "2020-05-06T08:08:43Z")

</div>

Hey @HarishArawala,

What you are trying to do is not supported. You are casting to the implementation details of the `Execution`. You can’t achieve that when using the query.

You can get the flow element of the execution by using the API in the following way:

```auto
BpmnModel model = repositoryService.getBpmnModel(execution.getProcessDefinitionId);
Process process = model.getMainProcess();

FlowElement executionFlowElement = process.getFlowElement(getCurrentActivityId(), true);
// do what you need with this

```

Cheers,  
Filip

---

_[View the full topic](https://forum.flowable.org/t/unable-to-get-currentflowelement-for-an-execution/5964)._
