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:
BpmnModel model = repositoryService.getBpmnModel(execution.getProcessDefinitionId);
Process process = model.getMainProcess();
FlowElement executionFlowElement = process.getFlowElement(getCurrentActivityId(), true);
// do what you need with this
Cheers,
Filip