Get Subprocess Name from Groovy

Hi everyone,

I am trying to query via Groovy the name of the current subprocess (as given in the modeler) from an activity within that sub process.

image

i.e. in the picture above, what would be the Groovy script attached to “get sub process name” that would print “a lovely sub process” ?

I searched and tried multiple ways through Javadoc studies, but to no avail.

Can it be done?

Many thanks in advance for your feedbacks!

  • Calli

You need to get the ModelInstanceElement. You should be able to get the Script task, and then likely get the “parent” of the script task. See the Model API: https://docs.camunda.org/manual/7.13/user-guide/model-api/bpmn-model-api/