Hi,
I have a process with 2 task lets say t1 and t2
I want to involve t1 task to a group namely everyone so that whenever user(who is involved in everyone group) clicks on process to view the process details user should be able to see the details of particular process
For this I have written a task listener assigned task to group at the time of task creation. unable to view the process details if logged in user is involved.How can I achieve this?
Regards
Anita Patil
What are you using APS or Activiti and what version?
Bassam Al-Sarori I am using APS 1.7
I believe that its possible in APS 1.8. Members of involved groups will be able to access tasks and processes.
Hello Bassam Al-Sarori I tried with APS 1.8.1 and tested It is working only when I involve group to task manually. With task listener it is not working.
I have printed in logs also,
Logs with task listener
groupId=5
after groupId=5
12:56:57,144 [http-nio-8082-exec-25] INFO com.activiti.extension.bean.InvolveAdminInAllTask - successfully involved to groupId
12:56:57,145 [http-nio-8082-exec-25] INFO com.activiti.extension.bean.InvolveAdminInAllTask - [Process=87501][event=assignment][TaskListener=com.activiti.extension.bean.InvolveAdminInAllTask@55671af8][ActivityId=sid-801B1B07-9D25-4208-B61B-6CBE754BFA4B][TaskAssignee=4 group id[IdentityLinkEntity[id=87507, type=candidate, groupId=5, taskId=87506]]][TaskForm=null]
12:57:00,082 [pool-7-thread-1] INFO com.activiti.service.runtime.ActivitiEventProcessingService - Processed 8 events
Logs with manually involved group to task
12:58:22,248 [http-nio-8082-exec-27] INFO com.activiti.service.runtime.AlfrescoTaskService - Involve group. Task: 87506(87501), group: 5
This is the code I have written for task listener
package com.activiti.extension.bean;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.task.IdentityLink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class InvolveAdminInAllTask implements TaskListener {
private static Logger logger = LoggerFactory.getLogger(InvolveAdminInAllTask.class);
@Override
public void notify(DelegateTask task)
{
DelegateExecution execution = task.getExecution();
try{
String groupId="5";
System.out.println("groupId="+groupId);
task.addCandidateGroup(groupId);
System.out.println("after groupId="+groupId);
logger.info("successfully involved to groupId");
logger.info("[Process=" + execution.getProcessInstanceId() + "][event=" + task.getEventName()
+ "][TaskListener=" + this + "][ActivityId=" + execution.getCurrentActivityId() + "][TaskAssignee="
+ task.getAssignee() + " group id" + task.getCandidates() + "][TaskForm=" + task.getFormKey() + "]");
}
catch(Exception e){
System.out.println("exception in InvolveAdminInAllTask="+e.getMessage());
logger.info("exception in InvolveAdminInAllTask="+e.getMessage());
}
}
}
Candidate type of involvement is used to queue tasks for group members to claim. Can you use participant type instead?
taskService.addGroupIdentityLink(taskId, groupId, IdentityLinkType.PARTICIPANT);
Thank you Bassam Al-Sarori I have added following lines of code it working now.
TaskService taskService=ProcessEngines.getDefaultProcessEngine().getTaskService();
taskService.addGroupIdentityLink(task.getId(), "5", "participant");
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.