camSDK and parallel subprocess variables

Hi…

I’m using camSDK in and external form using angular and loaded the form according to the documentation.
It all seems to work fine since I’m able to read the process variables from the loaded task but when I get to a task in a multi-instance subprocess I have no visibility to some control variables (i.e. “loopCounter” to identify which subprocess instance I’m dealing with).

Is it a bug? if not, how could I have access to these variables?

Hi @fcordova,

it sounds like a variable scope problem [1]. Make sure that the control variables are not defined locally to the user task but globally to the execution (process instance). Otherwise the variables won’t be visible within the task in your subprocess.

By the way I think a multi-instance task marker is not the right candidate for a loop. According to the BPMN 2.0 standard the number of repetitions is known before the multi-instance task gets executed.

Cheers,
Tassilo

[1] https://docs.camunda.org/manual/7.7/user-guide/process-engine/variables/#variable-scopes-and-variable-visibility

Hi @tasso94, thanks for your reply…

Actually, I’m not defining these variables, they are automatically defined by the engine once it starts the multi instance.

Maybe I haven’t properly described what I’m trying to do… Here’s the diagram:

So, there’s a subprocess configured as multi instance in parallel. The number of repetitions (ou parallel instances) is fixed in the modeler.

When I didn’t have an external form, each one of these instances showed a different value for the loopCounter variable (along with some other variables also injected by the engine), but none of them are available when I load them using camSDK.

You’re right… it’s a problem with the scope…
I’ve created new variables in the subprocess start event and they are also not visible when using camSDK from the external form.

Since I’m loading the form from a task in the subprocess, shouldn’t it automatically change to the corresponding scope ?

It not, is there any way to do it ?

Hi @fcordova,

when you create a variable outside the subprocess it is defined as global.
You can access this variable from any instance of your subprocess and change the value globally.

Does this answer your question?

Cheers,
Tassilo

1 Like

Actually, it was simpler than that… it was just a matter of forcing the load of those variables… :grimacing:
thanks anyway