0

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?

2 Answers2

2

Try:

execution.getProcessInstance().getName()

Or:

execution.getProcessInstance().getProcessDefinitionName()
Curtis
  • 548
  • 3
  • 13
1

Please try the below code snippet to get the Process Instance name.

HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance1.getProcessInstanceId()).singleResult();

 log.info(historicProcessInstance.getName());
Arjun
  • 624
  • 2
  • 6