Get Previous Activity name

How can be get the previous activity name when my current activity is getting executed?

You can use the history service to find previously activated tasks for the current instance

	execution.getProcessEngineServices().getHistoryService()
	.createHistoricTaskInstanceQuery()
	.processInstanceId(execution.getProcessInstanceId())
	.list();

1 Like

To get the list in the chronological order one case use

execution.getProcessEngineServices().getHistoryService()
  .createHistoricActivityInstanceQuery()
  .processInstanceId(execution.getProcessInstanceId())
  .orderByHistoricActivityInstanceEndTime()
  .asc()
  .list();