Start a process instance in a specific task

Hi,

Is possible to start a process instance in a different point of the flow ? For example:

Start --> Born --> Live --> Die --> End

If I create a new instance of the Procces above, the active activity will be Born. But if for some reason I want to start a new Instance and in the same way I want to the active activity to be Live, will camunda engine support this kind of behavior ?

@Felipe I think you are looking for “Start Instructions” parameter:

Optional. A JSON array of instructions that specify which activities to start the process instance at. If this property is omitted, the process instance starts at its default blank start event.

2 Likes

And the corresponding Java API: https://docs.camunda.org/manual/7.6/user-guide/process-engine/process-engine-concepts/#start-a-process-instance-at-any-set-of-activities

2 Likes

@thorben I was using startProcessInstance and the fluent API does not allow to call the method “startBeforeActivity” . The example in the link uses createProcessInstance, I tested it and it works as a charm… the only thing is that the execute() is deprecated. There is any limitation using createProcessInstance over startProcessInstance ?

Hi @Felipe,

I’m glad you got it working. #execute is deprecated in favor of #executeWithVariablesInReturn. It is perfectly fine to use #execute though and it won’t be removed in any future 7.x version. The functionality provided by the #createProcessInstance methods is a superset of that provided by the startProcessInstance methods.

Cheers,
Thorben

Hi @thorben,

Thanks for the precise and quick answer.

Cheers,
Felipe