Multi instance tasks - change cardinality dynamically

Hey, I’m looking for a way using the REST API changing the cardinality / collection of Multi Instance tasks.

I could not find a way doing so

Can you please assist?

Cheers

Can you elaborate on how you envision that working at runtime? Cardinality is defined at the process level, so to do so via the REST API, you’d basically have to update the deployment, which probably isn’t what you’re looking for.

You may want to look at the various document approaches for evaluating cardinality at runtime.

I’m looking for a way changing the number of activities dynamically, this is the general use-case I’m currently dealing with (both sequential and parallel activities)

Anything in particular in the example that doesn’t fit your use case? Seems like using an expression to evaluate a variable would do the trick. You could even use the rest api to update that variable.

It seems like the only way doing it, is by configuring a large fixed number for cardinality, and changing the expression condition to match the number of tasks required.
Isn’t it considered a ‘hack’?

Yeah, sounds hacky :slight_smile:

Couldn’t you use the same expression to set loopCardinality?

I think not, because I like to have the ability changing the cardinality before and after the activity started

Ah, that’s different. Given that cardinality is evaluated only when the activity starts, I don’t think there’s a standard for what to do with the in flight activities if the cardinality changes. You would likely have to model that or have some external mechanism for canceling activities that already started (if the number goes down) and starting new activities (if the number goes up).

I think that basing the decision on variables (i.e having 100 activities and exit condition would be based on a variable we set dynamically which is lower than 100) is dangerous since we have multiple users using the solution. Meaning one can finish his task, and second editing the variable for number of required activities, which would cause a major problem