Hi All,
I want to ask how to get usertask id based on process instance id. But in Java Code not use rest api?
my bpmn diagram is like this
id-eclaim.bpmn (4.4 KB)
I want to get usertaskid of create-action-id user task use java code. Can anyone show me sample code for do that?
Regards,
Dimas
@dimasrij , you can get specific taskId by passing process instance id and taskdefinitionKey as you mentioned above.
@Service
public class RuntimeTaskSericeImpl implements RuntimeTaskService {
@Autowired
private TaskService taskService;
@Override
public String getTaskId(String processInstanceId, String taskDefinitionkey) {
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId)
.taskDefinitionKey(taskDefinitionkey).singleResult();
return task.getId();
}
}
Here taskDefinitionkey
is the create-action-id
which configured for the user task.