I would like some guidance on how to query user tasks for a process. My process has two user tasks and what I have managed to do is to start a process programmatically but cannot proceed beyond that in terms of querying the tasks of the process and completing the tasks.
This is what I have in code:
Map<String, Object> variables = new HashMap<>(); User user = userRepository.findByUsername(assignee); System.out.println("Last Name: "+user.getLastname()); variables.put("user", user); variables.put("memberID", member.getId()); variables.put("Owner", user.getUsername()); ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder .start() .withProcessDefinitionKey(process_key) .withName(member.getFullname()) .withVariables(variables) .build()); GetTasksPayload getTasksPayload = new GetTasksPayload(); getTasksPayload.setProcessInstanceId(processInstance.getId()); getTasksPayload.setAssigneeId(user.getUsername()); Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 10), getTasksPayload); tasks.getContent().forEach(task -> { System.out.println("Task Name is :"+ task.getName()); });
The .foreach part does not print as expected.
Please assist.
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.