Get Current Process Version or VersionTag in Groovy Script

Hi everyone.

How do I get the Process Version or VersionTag of the current process using Groovy?

Searching for it I found the post https://forum.camunda.io/t/get-current-process-instance-id-in-groovy-script/2840/12 that get the Process Instance ID in this way ${execution.getProcessInstanceId()}.

I need something like this execution.getProcessVersion() or execution.getProcessVersionTag()

Thank you.

Hi @bsoares,

you can use execution.getProcessEngineServices() to get access to the engine API services. Then, you can execute different queries.
See for more details: https://docs.camunda.org/manual/7.7/user-guide/process-engine/scripting/#accessing-process-engine-services-using-scripts

Cheers
kristin

2 Likes

Thank you so much @kristin!

With ProcessEngineServices in hand I can get the Version Tag in this way:
${execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getVersionTag()}

getVersion() is also available.

:slight_smile:

1 Like