Hello Team,
I am using activiti 6 for designing business process for one of our project. The process is pretty straight forward, it consists of number of "User Taks" or "Service Task" with role based assignments. However our Client wants that an admin user should be able to rerun any of the previous "User Task" or "Service Task" at any point of time.
For example, following is my process :
Start –> Service-Task1 –>User-Task2 –>Service-Task3 –>User-Task4 –>Service-Task5 -> User-Task6 -> Service-Task7 -> User-Task8 ->End
Client want that at any point of time during a process execution, an admin user should be able to change workflow execution from : for example state "User-Task8" to any of Service-Task1 or User-Task2 or Service-Task3 or User-Task4 or Service-Task5 or User-Task6 or Service-Task7.
As per Alfresco Community thread : User Task Rollback
I have created a custom command as
public class RestartInstanceActivitiCommand implements Command<Void> {
private final String executionId;
private final FlowElement flowElement;
public RestartInstanceActivitiCommand(String executionId, FlowElement flowElement) {
this.executionId = executionId;
this.flowElement = flowElement;
}
public Void execute(CommandContext commandContext) {
ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(this.executionId);
execution.setCurrentFlowElement(flowElement);
return null;
}
}
And executed it with :
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
FlowElement flowElement = bpmnModel.getFlowElement("Service-Task1");
commandExecutor.execute(new RestartInstanceActivitiCommand(processInstanceId, flowElement));
runtimeService.trigger(processInstanceId);
With this the current task is set Service-Task1, but it is not getting executed automatically as a normal flow would do usually. Also I can see User-Task8 is also active and assigned to the user which I don't want becasue I want to cancel the current task and rerun it from the desired step.
Appreciate your help with a code sample.
Regards,
Sandip
Team,
Could you please reply if this is possible. If yes, way to do it.
Regards,
Sandip
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.