question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't inject configurations using element templates, if user provides no value

See original GitHub issue

Is your feature request related to a problem? Please describe

The user raising this issue, uses the element templates feature to let users easily configure elements. Notice that element templates allow to configure whether a custom input field is allowed to be empty or not (via the notEmpty constraint).

Now in some cases the users of the templated elements, leave custom input fields empty (which does not create an issue in the propPanel UI, since notEmpty was not set). However, this then makes in many cases the process not deployable, since the respective injected element, is not configured valid.

Concrete example:

  1. Have a field injections template (notice that the 2nd field injection does not have notEmpty set)
{
    "$schema": "https://unpkg.com/@camunda/element-templates-json-schema@0.4.0/resources/schema.json",
    "name": "Field Injections",
    "id": "com.camunda.example.FieldInjections",
    "appliesTo": [
      "bpmn:ServiceTask"
    ],
    "properties": [
      {
        "label": "Field Injection String",
        "type": "String",
        "value": "My Field Injection Value",
        "binding": {
          "type": "camunda:field",
          "name": "fieldInjectionString",
          "expression": false
        },
        "constraints": {
          "notEmpty": true
        }
      },
      {
        "label": "Field Injection Expression",
        "type": "String",
        "value": "${fieldInjectionExpression}",
        "editable": false,
        "binding": {
          "type": "camunda:field",
          "name": "fieldInjectionExpression",
          "expression": true
        }
      }
    ]
  }
  1. Apply the template
  2. Leave the 2nd custom field empty
  3. => You can now not deploy this process, because still two field injections were set in the XML, but the second one is not configured with a value.

Describe the solution you’d like

In the example case described above, it would be great if the second field injection would not be part of the XML (if the user leaves the respective custom input empty). This could be implemented in two ways:

A) always don’t insert elements, if the respective inputs are left blank B) don’t insert elements, if the respective inputs are left blank and an additional flag was set (e.g., optional)

Describe alternatives you’ve considered

See solutions.

Additional context

Raised via https://jira.camunda.com/browse/SUPPORT-12176 Related to https://github.com/bpmn-io/bpmn-js-properties-panel/issues/559

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
MaxTrucommented, Jan 14, 2022

So I looked at this again. While it would work (see https://github.com/bpmn-io/bpmn-js-properties-panel/commit/3adfaf4d8b34f5c585b3473cd3366d6c52a7bc38 for example), it indeed is a lot of work to refactor for all existing Camunda Platform bindings.

I propose to introduce optional for the currently starting Camunda Cloud implementation (if we find time).

1reaction
MaxTrucommented, Jan 10, 2022

Looks OK but let’s make sure we don’t allow optional=true and editable=false in the same property.

I can ensure that via the schema 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django templates: If false?
For posterity, I have a few NullBooleanField s and here's what I do: To check if it's True : {% if variable %}True{%...
Read more >
How To Use Templates in a Flask Application
If a user types in their username and password, you can use Flask to perform business logic: You extract the data (the username...
Read more >
Build Configuration Template - TeamCity On-Premises
If you want to have several similar (not necessarily identical) build configurations and be able to modify their common settings in one place ......
Read more >
Built-in template tags and filters
You can use any number of values in a cycle tag, separated by spaces. ... If the variable evaluates to a Template object,...
Read more >
Qute Reference Guide
Therefore, you can make use of any Quarkus-specific integration feature such as Template Extension Methods, Injecting Beans Directly In Templates or even ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found