04-16-2012 03:48 AM
getTaskForDocument = from Task
where id in(
select id from Task where EXECUTION_ID_ in(
select exec1.id from Execution exec1 where
exec1.BUSINESS_KEY_=:BUSINESS_KEY and
exec1.id in( select max(id) from Execution as exec2 where exec2.BUSINESS_KEY_ = exec1.BUSINESS_KEY_ )))
List tasksForDocument = Task.findAll(getTaskForDocument, [BUSINESS_KEY: "BUSINESS_KEY_here"]);
Is there any other effective way to get Task using BUSINESS_KEY (I don't like to have/define "Task" and "Execution" domain classes in my app)?
04-16-2012 01:40 PM
Is there any other effective way to get Task using BUSINESS_KEY (I don't like to have/define "Task" and "Execution" domain classes in my app)?
04-17-2012 06:56 AM
public List<Task> getTasksFromDocumentID(String documentId) {
List<Execution> executions = ActivitiUtils.getRuntimeService().createExecutionQuery()
.variableValueEquals('businessKey', documentId)
.orderByProcessInstanceId().desc().list();
if (executions.size() > 0) {
return ActivitiUtils.getTaskService().createTaskQuery()
.processInstanceId(executions.get(0)?.getProcessInstanceId())
.list();
} else {
return new ArrayList<Task>();
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.