I'm trying to get the latest process definition to perform various operations irrespective of any specific process. I also wanted to migrate my existing processes to the latest definition. Can someone guide me for the same? Docs are not of much help.
1 Answers
2
votes
You can query deployed process definitions using the RepositoryService (assuming you are using the java api):
repositoryService.createProcessDefinitionQuery()
.latestVersion()
.processDefinitionKey("myProcess")
.singleResult();
For process instance migration, you can create and execute MigrationPlans:
MigrationPlan migrationPlan = processEngine.getRuntimeService()
.createMigrationPlan("exampleProcess:1", "exampleProcess:2")
.mapActivities("assessCreditWorthiness", "assessCreditWorthiness")
.mapActivities("validateAddress", "validatePostalAddress")
.mapActivities("archiveApplication", "archiveApplication")
.build();
as documented here. There is also a community extension for instance migration , which is a bit outdated, but at least should give you some ideas how to work with the API.