cancel
Showing results for 
Search instead for 
Did you mean: 

complete Task

mhdshahdoost
Champ in-the-making
Champ in-the-making
hi , i have a BPMN 2.0 diagram that contain 2 human Task [user script] notations with two listener [TaskListener] bind to each notation.
each user script Listener show dialog box [swing base] and save some data into database , after user save data [click button] i want current task complete
and engine goes to another notation , i use this API :

        ProcessEngines.getDefaultProcessEngine().getTaskService().complete(taskid);

on Listener and after data save but get this error :


org.activiti.engine.ActivitiException: Cannot find task with id 2407
 

i checked database table [act_ru_task] and find after program closed this task create.

how can i complete current task with API ?
3 REPLIES 3

trademak
Star Contributor
Star Contributor
I really don't understand the question. Could you explain it in a better way and maybe post the process and the Java code you have developed?

Best regards,

mhdshahdoost
Champ in-the-making
Champ in-the-making
it's my BPMN diagram :
[attachment=0]MyProcess.png[/attachment]

and for example i have two TaskListener for each user task that only print something :


import org.activiti.engine.ProcessEngines;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

public class CCHHandler implements TaskListener{

@Override
public void notify(DelegateTask arg0) {
 
  System.out.println("CCH Task is start");
  ProcessEngines.getDefaultProcessEngine().getTaskService().complete(arg0.getId());
 
}

}

i want after print statement current task  complete and engine goes to next user task.but i get this error :


org.activiti.engine.ActivitiException: Cannot find task with id 816

because in this step current task not exist on database.

please help me for solve this

thanks

trademak
Star Contributor
Star Contributor
Hi,

Why are you completing the user task in a task listener???
That's why you get the exception.
Just remove the complete action from the task listener and it will be working fine.

Best regards.