cancel
Showing results for 
Search instead for 
Did you mean: 

adding people to multiinstance task

sri1991
Champ in-the-making
Champ in-the-making
I have a simple review process where the author of a document wants it to be reviewed by multiple reviewers and get feedback. I created a multiinstance task with the set of reviewers. If one or more reviewers think that the document to be reviewed requires additional people they can add them. Is there a way for the reviewers to add new people from within the multiinstance task? I am using activiti version that comes with Alfresco 4.1
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
There is no way of adding additional entries to the multi-instance collection once the Multi-instance activity has actually started. You can create a workaround by using a multi-instance sub-process. In that sub-process, there is a userTask (the review task) and it has 3 possible outcomes: "Approve", "Reject" or "Involve more people". After that task (still inside the subprocess) you add a gateway that checks the outcome and in case of "Involve more people", goos to a new UserTask. This UserTask has a form which allows the reviewer to select additional reviewers. After the additional reviewers are selected, a Multi-instance user-task is added which creates a task for each of the selected "newly involved reviewers".

You should, off course, make sure any variables you use (e.g.. approvalCount) is synced if the new "involved" tasks are added, so the final task showing the review-result shows correct percentages and so on.

Does that make sense?

gordonko
Champ in-the-making
Champ in-the-making
I have a similar question but this time I would like to remove a reviewer from the original list, is that possible to remove the existing user-task. If it is yes, can you provide some detailed info of how to implement it

jbarrez
Star Contributor
Star Contributor
No, that's not possible out of the box, unless you complete the task by the system

gordonko
Champ in-the-making
Champ in-the-making
I have searched the forum but cannot find a suitable solution for my requirement which will allow a user to add and remove assignee(s) to the current task as well as the incoming tasks.

I try to use the following approach to solve the problem. Would like to have people review it before I start to implement.

The workflow has 3 sequential tasks – Review, PostReview and Conclusion

1)      “Review” is a user task which allow assignee(s) approve or reject the workflow. It also allow to add or remove assignee(s).
2)      “PostReview” is a service task which runs after “Review”
3)      “Conclusion”is another service task which runs after “PostReview” once all assignee(s) approve/reject the work

All assignee will be kept in the run-time variable as a list. We can use setVariableLocal and getVariableLocal to access the list.

The assignee can approve or reject from UI associated with “Review” task. Once assignee send the request down to engine, the “PostReview” will check if all assignees made his or her decision. If not all assignee made the decision yet,  then the “PostReview” will flow back to “Review” task. It means there is always one instance of “Review” task for multiple assignees, a race condition will happen and a database-based mutex will be used to lock the task to avoid any side effect at “Conclusion” task (in case there is non-transactional work inside the "Conclusion" task.

Please review this approach to see if this is a doable solution. If there is any build-in features that I can use, please advise and I am really appreciate your help



martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,
If list of approvers is static, you can use multiinstance tasks. (In other case you could use workaround proposed by Frederik).

Regards
Martin

gordonko
Champ in-the-making
Champ in-the-making
Thank you for your feedback. Multiinstance can help solve part of my problem but not all.

There are two cases that lead me to use my own approach instead of using multiinstance

1) I want to not only add assignee(s) but also remove assignee(s)
2) I want to not only add/remove assignee(s) for the current task but also for the future tasks.

Anyway I think using run-time variables, to store the assignee list, are something cannot avoid

Thanks - GKO