Hello,
Is there a way to start a process in a different point of the flow? example:
Start --> fristUserTask --> secondUserTask --> thirdUserTask --> End
If I create a new instance of the Procces above, the active activity will be "fristUserTask". 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 "thirdUserTask", will activiti engine support this kind of behavior?
I have a lot of legacy process running outside of engine and I'd like to start in different points depending of process.
Thanks.
Hey willian,
I wonder if perhaps you could add a simple form task to the beginning of your workflow with a dropdown field to choose the starting point of your workflow. You could then use the sequence flows to determine which task is executed after the start with logic like 'if (startingpointdropdown = second)'. It might look something like this:
hi Mitch Gundrum, thanks for you help,
I found another solution using activiti api, I just share if anyone needs it in the future:
public class StartProcessIntoActivity implements Command<ExecutionEntity>, Serializable {
private static final long serialVersionUID = 1L;
private String businessKey;
private String processKey;
private String initialActivity;
private Map<String, Object> variables ;
public StartProcessIntoActivity(String processKey, String businessKey, String initialActivity, Map<String, Object> variables) {
this.businessKey = businessKey;
this.initialActivity = initialActivity;
this.processKey = processKey;
this.variables = variables;
}
@Override
public ExecutionEntity execute(CommandContext commandContext) {
DeploymentManager deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentManager();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKey(processKey);
ActivityImpl initial = processDefinition.getActivities().stream().filter(f -> f.getId().equalsIgnoreCase(initialActivity)).findFirst().orElse(null);
ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, initial);
processDefinition.setVariables(variables);
processInstance.start();
return processInstance;
}
}
Just call the command using:
managementService.executeCommand(new StartProcessIntoActivity("_123456", businessKey, "Task_1f6r24w",variables))
Thanks
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.