Hello,
In a process, I would like to create tasks dynamically based on parameters passed at the creation of the process.
For example, from ADF, I would like to create a form that allows me to select from 1 to N reviewers.
On APS, I would like the process to be able to create N proofreader tasks.
Is it possible to loop through a list of proofreaders to create one task per proofreader?
I specify that the tasks should not be in parallel. If Proofreader 1 rejects the document, the process must stop.
Thank you
Instead of creating the task "dynamically" (ssuming throught java code). you can try an inbuilt feature called multi instance. you can provide your list of proofreaders (user ids) as parameters and assign each task using a variable.
As for you rejection condition, you can store outcome of each task in a variable and check that variable's value in completion condition.
more on this in docs - https://docs.alfresco.com/process-services1.11/topics/user_task.html
a working example is posted here - https://hub.alfresco.com/t5/alfresco-process-services/parallel-multi-instance-dynamic-task-candidate...
hope it helps.
Hello,
Thank you for your answer !
indeed the 'multi instance' feature would suit me perfectly. Except that I'm a bit blocked! What should we put in the "collection" field ? a list ? a variable ? In APS, you can only create string, int, boolean variables, but no array...
Would an array of the style ['usernameA", "usernameB", "usernameC"] be enough in this field ?
If yes, can we assign each task to each user via his username?
Thanks in advance for your help
Collection requires a serializable list, e.g. you can do it via a groovy script (or java code).
List<String> groups = [ '1001', '1002', '1002'] as String[]; execution.setVariable('myCollection', groups );
You'll have to provide db userId for task assignment.
Thank you for your help! Your code works!
Except that, I choose the "sequential" multi instance type, it doesn't work properly. This mode launches the tasks all at the same time... I think it's a bug.
The behavior is the same if we select the type of multi-instance "parallel".
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.