Can not see process variable specific to execution path on cockpit when two execution paths used the same process variable name

Hi Community!

I am trying to use cockpit (v7.12 community) to observe process variable when there are two execution paths. But I can not see process variable specific to one execution path on cockpit when two execution paths set same process variable name.

  1. execution path 1
  2. execution path 2

Can not see process variable specific to execution path on cockpit when two execution paths have same variable name.bpmn (5.0 KB)

I expected to see on cockpit will somehow show my variable procOutput base on the TWO execution paths, but the result is - I only see execution path 2’s result.

Do I miss something? Or it’s just a feature that cockpit does not support? I understand I can still use API to really read that “execution path scope” variable. But is there anyway I can still show both execution paths’ process variables on the cockpit?

Googled a bit and tried searching on the forum but to no avail, any feedback is welcome!

Best,
Tommy

Hi @tmy2017,

As per camunda docs,
the name attribute of an outputParameter denotes the variable name outside of the activity

Which means that the created variable is linked with activity instance outside the configured activity and for both configured activities (path1 & path2) in your case the outside activity is the root activity instance which is corresponding to the process instance itself.

If you try to set local variables using Execution Listener(s) on event of taking transition for both outgoing sequences getting out of start event then you would get two different variables each linked with its corresponding execution

image

1 Like

hi @hassang, really many thanks for helping out!

I followed what you described above, then really when I use setVariableLocal I can observe two execution path’s own variable from Cockpit. Awesome!


Just being curious, I still did a bit experiment.

I notice the activities on two execution paths can actually still see the process variable on its own path, instead of the top level activity instance’s variable.

Ex: when I try to read procOutput variable from stop & wait 1 task, the value is “path1” on Cockpit (the value came from step path 1). And I did the same thing for stop & wait 2 task, then I can see value is “path2” on Cockpit.

Thus I understand two activities on two execution paths can see process instance variable “on its own path”.

However, I am curious is there a way to “drill down” into two execution paths on Cockpit, to see procOutput’s values as “path1” on execution path 1, while as “path2” on execution path 2?.*

Currently I see Cockpit shows top scope activity instance process variable procOutput as only ONE value (marked in red), which I can understand since it’s the “process instance” scope. But just hope there is a way I can also observe what is inside those execution paths.

My process def. is here:


Lastly, I’m curious in this is due to - I have two execution paths which two external service task would set same process variable (ex: userIdOnThisExecutionPath). Thus on Cockpit I would like to find an easy way to observe those values with same process variable name for our system admin.


All in all, thanks @hassang now I at least know one solution is to use execution.setVariablelocal to achieve what I want.

Hi @tmy2017,

The name attribute of an inputParameter denotes the variable name inside the activity (a local variable to be created)

In your attached process definition, both path1usertask and path2usertask get created as local variables and values get evaluated on creation time.

When “stop & wait 1” task gets created procOutput variable holds the value of “path1” so path1usertask local variable gets the value of “path1” and when “stop & wait 2” task gets created procOutput variable holds the value of “path2” so path2usertask local variable gets the value of “path2”.

1 Like

It seems if no variable available outside the activity with the name specified for outputParameter then the new created variable always gets created on process instance level. (I tried to have activities “path1 & path2” in two different sub-processes but still only one variable got created on process instance level “I expected two to get created on sub-process level”)

@Niall, could you please confirm that my understanding is correct.

hi! @hassang, just once again thank you for your clear explanation!

Got it, it’s clear for me the concept of local variable inside activity when inputParameter is used (and thanks for pointing to the official doc).

Wow, so the problem might not due to cockpit. Following your line of thinking - so it might be that - when creating variable, it’s always at process instance level. If that’s true, then it explains everything.

Alrighty, then I guess now we can only wait for Niall’s answer.

But really, learned a lot and thanks for all the help @hassang!