Workflow Removing Tasks Dynamically During Process Instance Running...Bad?


I am working on a project where I want to have a user go through several steps in a workflow process, and at a certain point in the process, assign a number of parallel user tasks. I’d like to have each task represented by its own called BPMN so that I may re-use the same tasks across other workflow possibilities. I know that I can call specific BPMNs dynamically, but what I want to be able to do is to call a number of specific BPMNs that each carry their own tasks that can be done in parallel.

The only way I’ve found to do this is to create BPMNs for every possible task combination I have, which is pretty cumbersome. My ideal would be that, if I have BPMNs X, Y and Z, that based upon the user’s workflow responses up until that point, we assign any combination of X, Y and Z to them.

Can the below work, or is it bad practice?

In reading the docs, I know that I can modify a running process instance and remove/delete specific tasks from a workflow before the user encounters them in the workflow…so I had the thought that I could have ALL of my possible tasks in the workflow, with the default assumption that they will ALL be assigned to the user when their running instance reaches that point in the flow, but based upon certain variables at that point, I remove a number of the tasks.

Is this sloppy, or a bad pattern to try to make work? Any help would be great…thanks!

Hi @Lee_Broxson
Can you upload your process model? Might help with understanding the options that you’ve tried.

1 Like

are you using decision tasks?

I am not using decision tasks…only been evaluating/building POC with Camunda for the last month or so, so am a bit of a novice.

Would decision tasks allow for assignment based on variables?

Thanks for the response! I’ll try to provide as much info as I can.

The process model isn’t quite complete, but let me attempt to explain what I’ve done so far w/ some bpmn pics. Because I am a new user, I can’t post more than one pic per post, so I will post two more in the replies in addition to this one.

Pic 1 below shows a parallel gate that opens up to two call activities, each of which is intended to call other bpmns:
Screen Shot 2021-05-24 at 11.33.33 AM

One of those two bpmns, “Questionnaire specific tasks”, I want to have be a combination of 1-5 possible tasks. In lieu of not knowing how to generate them dynamically, I have created a number of bpmns that can be called named, “Persona1-tasklist”, “Persona2-tasklist”, “Persona3-tasklist”, etc.

I will then have the call activity pull a variable set during the process instance to dynamically call the correct persona. Pic 2 and Pic 3 below show two shots of two of my Persona bpmns that can be called.

Notice that both of them share a couple of the same tasks. This is the only way I could figure out to have this be possible.

The challenges this method presents are mainly around scalability…I currently have 3 tasks, and so for every combination of possibilities, that requires 7 separate bpmns. If we add a 4th, 5th or more tasks, then we start looking at an n^2 number of expansion of bpmns, which is unsustainable.

Any insight or ideas would be great. If this is unclear, I can try to provide more detail. Thanks!

Pic 2:Screen Shot 2021-05-24 at 11.52.55 AM

Pic 3

In looking through the page you linked, I think it doesn’t quite fit my use case, as I am trying to add tasks to a process instance dynamically, rather than assigning users dynamically.

The workflow I am working on has no users to speak of, and we want to drive the tasklist based upon the process instance itself, assuming that only one user will ever be using the process instance.

If I’m misunderstanding and there is a way to use a DMN table to assign tasks to a process instance, any insight would be helpful.


Hi @Lee_Broxson,

I have withdrawn my previous post.

I think implementing each of your main processes (Persona & Questionnaire) as single parallel multi-instance task could do the trick.

As an example “Persona” process can be simply implemented as single parallel multi-instance task as in below snip

Kindly find attached running “persona” process (for demonstration purposes: a collection JSON variable has been set to two persona objects through a script execution listener on start event) persona_process.bpmn (2.8 KB)

var json = S('[{\"personaName\": \"001\", \"personaAssignee\": \"user1\"}, {\"personaName\": \"002\", \"personaAssignee\": \"user2\"}]');
execution.setVariable('personas', json);


Thank you for the reply.

I’m not certain this solves for my use case, unless I am misunderstanding. We don’t make use of users in the workflow itself–though perhaps there is an applicable way to do so that I am not seeing.

We’re currently tying each of our user accounts going through our onboarding workflow to a process instance. Each process instance will have a 1:1 relation to our user accounts.

Imagine that we have a pool of 5 possible predefined tasks for the end of the workflow, and through various user and service tasks along the workflow, we want to reach a point in the workflow where we add any combination of those tasks to the running process instance.

Only way I’ve found to make this work so far is to create a bpmn for each possible combination of the five tasks that we can call and have that bpmn be a called activity based upon variables we have set along the way.

Hi @Lee_Broxson,

I understand that at some point of a running process instance, a combination of predefined tasks to be created dynamically.

Let’s say for process instance A, task 1 and task 2 to be created wheares for process instance B, task 1, task 2 and task 3 to be created.

Regardless of the task type the proposed solution should work so for process instance A, a collection variable of two elements to be processed which in turn creates two tasks and for process instance B, a collection variable of 3 elements to be processed which in turn creates 3 tasks.

1 Like

Okay, I did not quite understand how multi instance tasks could work for me here, but I experimented with the process you shared and figured out what I need.

I’ve taken a call activity and made it a parallel multi-task instance, and I’ve broken all of my individual tasks out into their own individual processes. Before reaching the instance, I will have assembled a series of process variables in an iterable that I can then use with the multi-instance call activity to call which ones based upon which variables I have.

It seems to work, so I’ve got a place to go from.


1 Like