0
votes

I am trying to make some changes in the runtime of a process using the Fluent API. Is it possible to update the running instance?

Ex: If I want to add a new event between existing events (user Task, Service Task, ...) and run the newly added event. Is there a way to achieve this?

1

1 Answers

0
votes

You could do it as follows:

  1. Create the new version of the process and deploy it.
  2. Migrate the process instance to that version.

Minimal code example for step 2:

RuntimeService runtimeService = ..;
ProcessInstance processInstance = ..;

ProcessDefinition oldDefinition = ..;
ProcessDefinition newDefinition = ..;

MigrationPlan migrationPlan = runtimeService
  .createMigrationPlan(oldDefinition.getId(), newDefinition.getId())
  .mapEqualActivities()
  .build();

runtimeSerivce.newMigration(migrationPlan)
  .processInstanceIds(processInstance.getId())
  .execute();

Further reading: