Hi,
We are using Enterprise Activiti 1.5, I'm trying get the assignee details in the java code that's invoked from "ExecutionListener" of the User Task but not able to get it.
I'm able to get the assignee details in the java code using "TaskListener" of the User Task like below,
String assignee = delegateTask.getAssignee()
Is it possible to get the assignee details in "ExectionListener"? Please let me know.
Thanks!
Hi eramesh _ ,
Did you set the candidate users for the user task?
For example,
<userTask id="task" name="My Task" activiti:candidateUsers="${ldapService.findAllSales()}"/>
Then, if the assignee is within the candidate users, delegateTask.getAssignee() should return the Assignee correctly.
Thanks,
Thong Huynh
HI eramesh _ ,
Apologies, I didn't notice that you were specifically referring to ExecutionListener.
Did you try this?
public class MyExecutionListener implements ExecutionListener {
Logger logger = Logger.getLogger(MyExecutionListener.class);
public void notify(DelegateExecution execution) throws Exception {
// TODO Auto-generated method stub
logger.info("Execution, task assignee: " +
execution.getEngineServices()
.getTaskService().createTaskQuery()
.processInstanceId(execution.getProcessInstanceId()).singleResult().getAssignee());
}}
As an alternative, you can create TaskListener to handle more actions upon task events, here's an example
public class MyTaskCreateListener implements TaskListener {
Logger logger = Logger.getLogger(MyTaskCreateListener.class);
public void notify(DelegateTask delegateTask) {
// Custom logic goes here
logger.info("User task is created.");
logger.info("Listener executed.");
logger.info("Delegate Task assignee: " + delegateTask.getAssignee());
DelegateExecution execution = delegateTask.getExecution();
RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
runtimeService.signalEventReceived("EMAIL_SUPPORT_SIGNAL");
}
}
Thanks,
Thong Huynh
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.