cancel
Showing results for 
Search instead for 
Did you mean: 

Empty User Task List (for kermit), though workflow spec has numerous

sankarts
Champ in-the-making
Champ in-the-making
In my workflow spec i.e. "my_bpmn.bpmn20.xml"
a) There are more than one User Task
b) Every User Task has been assigned to "kermit"

But, when I try to retrieve the list of user tasks assigned to "kermit", it returns empty list. The code snippet is as below.

Queries:
1) Why the task list for "kermit" is empty? Is anything missing / misconfigured in the code snippet?
2) How to verify the deployment and starting process instance were successful?
3) Can I make use of Activity Exploer only for viewing the deployments, running process instances and the current state of each instance? (Deployment, starting instance, completing task etc would be programmatic)
4) How to complete my User Task (which is HTML form)? How to say that this HTML file should get launched for a User Task?


ProcessEngine processEngine = ProcessEngineConfiguration
            .createStandaloneInMemProcessEngineConfiguration()
            .buildProcessEngine();
      
      runtimeService = processEngine.getRuntimeService();
      
      RepositoryService repositoryService = processEngine.getRepositoryService();
      
      IdentityService identityService = processEngine.getIdentityService();
      TaskService taskService = processEngine.getTaskService();
            
      repositoryService.createDeployment()
            .addClasspathResource("my_bpmn.bpmn20.xml").
            deploy();
      
      
      Map<String,Object> variables = new HashMap<String, Object>();
      variables.put("abc", "xyz");
      
      identityService.setAuthenticatedUserId("kermit");
      
      ProcessInstance processInstance =
            runtimeService.startProcessInstanceByKey("my_process", generateWorkOrderId(), variables);
            if(null == processInstance.getId() )
               System.out.println("Null Process Instance ID");
            System.out.println("id " + processInstance.getId() + " " +
            processInstance.getProcessDefinitionId());
            
      List<Task> taskList = taskService.createTaskQuery()
            .taskCandidateUser("kermit").list();
      System.out.println("Task List Size: " + taskList.size());
      System.out.println("found task " + taskList.get(0).getName());
      taskService.complete(taskList.get(0).getId());


Thanks in advance.
4 REPLIES 4

sankarts
Champ in-the-making
Champ in-the-making
Any kind of meaningful input / response on this query would be greatly appreciated. Thanks.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Shankar,

Did you try to get user tasks for process instance? (or assigned to kermit?) (CandidateUser selects tasks for which the given user is a candidate. )

Regards
Martin

sankarts
Champ in-the-making
Champ in-the-making
Hi Martin,

I tried to retrieve the list of User Tasks assigned to kermit. I believe the following line of code (in my code snippet) should fetch the same.

<java>
List<Task> taskList = taskService.createTaskQuery()
    .taskCandidateUser("kermit").list();
</java>

Is there anything wrong / missing in my initial post?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

create and share jUnit test.

Regards
Martin