09-07-2020 10:18 AM
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
09-25-2020 03:04 AM
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.
10-20-2020 09:27 AM
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
10-21-2020 09:44 AM
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.
10-30-2020 08:10 AM
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".
Explore our Alfresco products with the links below. Use labels to filter content by product module.