Loop in process model: How to handle the process variables?

Hi all

I have modelled a business process, where it is possible, that multiple tokens are currently on the same activity.

See following simplified process model:

Every time a new loop is started in activity A, the process variables should be unique for the new run. The selection in A impacts the subsequent XOR, OR and the activities B and C.

How would you handle this situation?

Thank you

Can you provide some more details on the scenario or at least a fiction equivalent scenario.

Sure.
In A, the user defines tasks to be done (do x, do y etc.). If no tasks are defined, the run ends.

The user can specify for every task, whether he wants to wait for the result (sync) of the task or not (async).

The synchronous tasks are handled in B, the asynchronous tasks in C.

B and C are both parallel multi instance activities.

@miguelgalaxy if you have your End event after C, and add a new End event After B, does a Message End Event that calls a new instance of the process, will that cover your use case? This way you are not over-writing your variables, and using a single instance that could go on forever.

@StephenOTT

Thank you for your reply.

You mean something like the following?

This would cover my use case. But I need to be able to show to the user, what happend inside the process instance (this means inside the process instance + newly created process instances with the message event).

Is there a way to “connect” the process instance calling the message end event and the created process instance caused by the message event?

1 Like

You could use a common process variable (such as or similar to a Business Key).

Are you using Cockpit to "view what happened inside the process) or have you created another app?

When you create the first instance of the process you could set or generate essentially a UUID that could be passed to any subsequent processes through the Message. You can then run a filter based on that UUID to see all the instances related to it.

With this, you should not need your parallel gateway.

At what point do you want to activate the subsequent process(es)? In your current design you could have new process started before the async tasks © are completed.

Hi,

Your use case sounds like a good candidate for CMMN. In CMMN, you can have a UI where the user can initiate multiple discrete process instances and thus each instance has its own context…

There is a good example here in the consulting repository - Thus a case has a user task which uses a form to provide the UI. The UI can launch optional tasks and processes. Thus this form is a kind of single page app used to interact with the engine through the case paradigm.

regards

Rob