bpmn-io / bpmn-js-properties-panel

A properties panel for bpmn-js.
MIT License
294 stars 197 forks source link

Support custom scopes and tooltips for FEEL expression execution context #1053

Open sbuettner opened 5 months ago

sbuettner commented 5 months ago

Is your feature request related to a problem? Please describe.

FEEL expressions are supported in various ways by the properties panel. They can be applied to element templates, input- and output-mappings as well as other places. Not all FEEL expressions are evaluated by zeebe and share the scope of a process instance. This is confusing for users as certain variables are not accessible depending on the scope and the execution context where the evaluation is executed.

A scope property that allows developers to specify the scope of the FEEL expression would help to provide additional guidance for users which variables are available and what they can do with a FEEL expression for different elements (user tasks, outbound- and inbound connectors).

Describe the solution you'd like

A concept for defining a scope and visual support and explanation that guides users which variables are accessible depending on the scope of a FEEL expression. Element templates for example could define the scope where a FEEL expression will be executed in. The default could be process or zeebe. The result expression that is evaluated by the connectors runtime could define a different value that would then lead to a different pop-up/tooltip and would indicate that process variables are not accessible in that expression.

A new UX concept will be required for the FEEL expression fields that allows to provide additional information to users in which scope/context an expression is executed.

Describe alternatives you've considered

We leave the situation as is and live with a slightly confusing solution.

Additional context

https://forum.camunda.io/t/rest-connector-result-expression-cant-access-process-instance-variables/52399 https://camunda.slack.com/archives/C02JLRNQQ05/p1715953406647549

sbuettner commented 5 months ago

@YanaSegal FYI

barmac commented 5 months ago

Thanks for opening this issue. From the FEEL perspective, what you are proposing is to have a way to define the context available for a given expression. In the engine runtime, the available contexts could be:

In the connector runtime, the first two above are not available. Within the bpmn-js-element-templates project, we already don't display the detected process variables for zeebe:property and zeebe:taskHeader properties. How is that different from your requirements?

sbuettner commented 5 months ago

Great question @barmac, its more a UX issue from my perspective. Even if code completion is not suggesting any variables its visually not clear that a certain FEEL expression is running in a different context and with a different scope. Hence the idea to involve @YanaSegal so we can think about a visual cue to better guide our users on their journey.

barmac commented 5 months ago

I agree, it's easy to miss that detail, and I have also fallen into that trap. I am looking forward to your ideas how to improve this.

nikku commented 5 months ago

@barmac As discussed: Consider to add your diagram, explaining scopes to this issue.

barmac commented 5 months ago

To visualize the scopes, I created this diagram:

image

connector.bpmn.txt

It shows that process variables are not available in the result expression, but they can be accessed in the input and output mapping. On the other hand, the result expression can access the connector job result which is invisible to the engine.

sbuettner commented 5 months ago

Thanks @barmac in addition to that we have the inbound Connectors which run outside of the scope of a process. This is usually a place where users are getting confused about the scopes as they dont have access to process variables (only exception is the correlationKey variable).

YanaSegal commented 3 weeks ago

Hi, @barmac do we have any documentation that explains this:

In the engine runtime, the available contexts could be: process variables context (defined mostly in the element outputs) execution context (variables related to the process instance state, if available) - not available right now built-in functions context

How can our users understand / learn about this concept?

barmac commented 3 weeks ago

AFAIK we don't speak of contexts explicitly in the documentation, but you can read about available functions or variables, e.g. https://docs.camunda.io/docs/components/connectors/protocol/rest/#output-mapping

I think the suggestions can be the main source of knowledge given we provide them (which we don't for the response, but do for outputs and built-in functions).

YanaSegal commented 3 weeks ago

@barmac and I discussed this issue today; we started by understanding the high-level problem. we also looped @johnbgood meeting outcome:

crobbins215 commented 1 week ago

@barmac, who owns this to move forward? I see @YanaSegal is currently assigned, with the above looking like it's gone back to @johnBgood. I want to make sure we avoid connector-only solutions. I can see this as something that would be useful to support in the core, and the connector team can use it based on the use case @sbuettner set out.

barmac commented 1 week ago

We are now waiting for the input from @johnBgood. Some problems can be solved in the specific connector templates or in the documentation (so by the Connectors team). Then, we can discuss what is missing in the core for the element templates to be successful.

johnBgood commented 2 days ago

@barmac I shared the document with the team, I think @sbuettner provided some insights, as did I. Not sure what's expected from me now?

crobbins215 commented 1 day ago

@crobbins215 to create cross team epic