One of the generic solution is handling taskflow programatically, To achieve this you should get an object of a taskflow at managed bean and then you can call its methods for controlling in taskflow.
You can use the below method for this purpose.
Note you pass to the method taskFlowName used in page definition not the original taskflow name.
public static DCTaskFlowBinding getTaskFlow(String taskFlowName) {
BindingContext bindingCtx = BindingContext.getCurrent();
DCBindingContainer dcbCon = (DCBindingContainer)bindingCtx.getCurrentBindingsEntry();
DCTaskFlowBinding taskFlow = (DCTaskFlowBinding)dcbCon.findExecutableBinding(taskFlowName);
return taskFlow;
}
Thanks