Dynamically setting FormKey based on Process Instance and Task Id

Thank you for the reply @Ingo_Richtsmeier, I’m struggling a litle bit with this since I’m not yet familiar with Java.

Should I be able to access the delegateTask.getDefinitionKey() as a Java class in a Groovy script like this?