I think I understand now, I think I would do it this way:
Remove the Actor assignment to the task, it’s not required.
In a script connector:
- get the current user
- Start the Task
- (you must then wait for it to initiate)
- Assign the Task to the User
El siguiente código no está completo y trabaja en nuestro medio ambiente, pero que puede ayudar, tendrá que crear algunas variables para el nombre actual proceso, nombre de la tarea y el ID de usuario, etc. para hacer que funcione. Pero le guiará en la dirección correcta (lo que me queda en el código de depuración, esto se utiliza para asegurarse de que utiliza correctamente):
ENG: The following code is NOT COMPLETE and works in our environment but it may help you, you will need to create some variables for current process name, task name and user id etc. to make it work. But it will guide you in the correct direction (I have left in debug code, this was used to ensure it operated correctly):
Para el proceso y pisa el usuario ...
//Get Human Tasks
//Obtener Tareas Humanos
SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 100);
searchOptionsBuilder.filter(HumanTaskInstanceSearchDescriptor.NAME, processIdent[0]);
SearchOptions searchOptions = searchOptionsBuilder.done();
if(debug){dI++; logger.severe(thisTrace+"A4: Writing userTasks - START");}
SearchResult<HumanTaskInstance> searchHumanTaskInstances = processAPI.searchHumanTaskInstances(searchOptions);
if(debug){dI++; logger.severe(thisTrace+"B4-For: ");}
//Loop though found tasks
//Bucle a través de las tareas que se encuentran
for (HumanTaskInstance pendingTask : searchHumanTaskInstances.getResult()) {
if(debug){dI++; logger.severe(dI+thisTrace+"In-For HumanTaskInstance: ");}
if(debug){dI++; logger.severe(dI+thisTrace+"processProcessId[0]: "+processProcessId[0]);}
if(debug){dI++; logger.severe(dI+thisTrace+"processProcessId[1]: "+processProcessId[1]);}
if(debug){dI++; logger.severe(dI+thisTrace+"pendingTask.getId(): "+pendingTask.getId());}
if(debug){dI++; logger.severe(dI+thisTrace+"pendingTask.getParentContainerId(): "+pendingTask.getParentContainerId());}
if(debug){dI++; logger.severe(dI+thisTrace+"pendingTask.getParentProcessInstanceId(): "+pendingTask.getParentProcessInstanceId());}
//Find tasks for this processID
//Encuentra las tareas de este proceso ID
if (pendingTask.getParentProcessInstanceId().toString().equals(processProcessId[1].toString())){
if(debug){dI++; logger.severe(dI+thisTrace+"A4-pt: "+pendingTask.getName()+" "+pendingTask.getId()+" "+pendingTask.getParentProcessInstanceId());}
if (pendingTask.getId()>activityId){
activityId = pendingTask.getId();
if(debug){dI++; logger.severe(dI+thisTrace+"process.split(:): "+processProcessId[0]+" "+processProcessId[1]+" "+activityId);}
}
}
}
if(debug){dI++; logger.severe(dI+thisTrace+"After-For: ");}
//Force the process and step on the user…
//Para el proceso y pisa el usuario …
try{
if(debug){dI++; logger.severe(dI+thisTrace+"processProcessId[2]: "+processProcessId[2].toString());}
String bonUser = processProcessId[2].substring(processProcessId[2].lastIndexOf("(") + 1, processProcessId[2].indexOf(")"));
bonUser = bonUser.replace(" ", ".");
userid = identityAPI.getUserByUserName(bonUser.toLowerCase());
if(debug){dI++; logger.severe(dI+thisTrace+"userID : "+userid.toString());}
try{
processAPI.assignUserTask(activityId, userid.getId());
processAPI.updateDueDateOfTask(activityId, dueDate); //otherwise c?
if(debug){dI++; logger.severe(dI+thisTrace+"A7 userid.getId(): "+userid.getId());}
}
catch(Exception ass1){
logger.severe(thisTrace+"Ass1 : "+ass1.toString());
}
catch(Exception u1){
logger.severe(thisTrace+"userID u1 : "+u1.toString());
}
}
catch(Exception e5){
logger.severe(thisTrace+"Exception e5\n\n"+e5.toString());
}
regards
Seán
PS: If this reply answers your question, please mark a resolved.