How can we define a User (A) as a viewer of a task which is assigned to another user (B)

cancel
Showing results for 
Search instead for 
Did you mean: 
Member II

How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

Scenario is Task A submitted by User A navigates to Task B assigned to User B,    how can I set User A as viewer (which can monitor) of Task B whose assignee is User B.

I tried Candidate user in this case but not working as Candidate User has to Claim the task but in my case task is already assigned to another user.

next point will be Can a user Group be viewer just like we have User A for Task B???

answer with example will be highly appreciated.

1 Solution

Accepted Solutions
Alfresco Employee

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

There is no harm of involving a user as a candidate. To add a user as a participant use the TaskService addUserIdentityLink method TaskService (Activiti - Engine 5.22.0 API) 

taskService.addUserIdentityLink("1001", "kermit", IdentityLinkType.PARTICIPANT);

View solution in original post

6 Replies
Member II

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

I got the solution for my first question how User-A can watch task which is assigned to user B, User A could be 

activiti:candidateUsers="${User-A}"                       in respective task definition whereas

//Java Code

List<Task> involvedTaskList  = taskService.createTaskQuery().taskInvolvedUser("User-A").list();

this list returns all the tasks in which User-A is involved (either assigned or Candidate)

now 

task.getAssignee()

gives me difference in the tasks assigned to User-A and task in which he is Candidate.

I will post my second answer once i will get solution.

Alfresco Employee

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

You can involve the user to the task. "candidate" is a special type of involvement which allows the user to claim the task. But you can involve the user as a "participant".

Member II

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

thanks Bassam, couple of clarifications required

1. what is harm if I move forward with Candidate User and get involved tasks no matter I will not claim them 

2. can you please give example how to add user as a participant in task (java code)

Alfresco Employee

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

There is no harm of involving a user as a candidate. To add a user as a participant use the TaskService addUserIdentityLink method TaskService (Activiti - Engine 5.22.0 API) 

taskService.addUserIdentityLink("1001", "kermit", IdentityLinkType.PARTICIPANT);

View solution in original post

Member II

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

bundle of thanks brother, pretty much clear

Active Member II

Re: How can we define a User (A) as a viewer of a task which is assigned to another user (B)

Jump to solution

Hello Bassam Al-Sarori‌ Even I have the same case. can you post your working code it will be help full.