I need to develop a script that change dynamically the Process Instance name (in Alfresco APS 1.9). The change is conditional, like "If the name is 'ABC' then new name = 'ABC 2', else name = 'ABC 3' ".
I've found that to rename the Process Instance I can use the Groovy script below and it works fine:
execution.getEngineServices().getRuntimeService().setProcessInstanceName(execution.getProcessInstanceId(), "ABC 2");
But I need to get the current Process Instance name to check which would be the new name (How to get 'ABC' in my example above).
How can I get the Process Instance name using Groovy?