Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow conditional choices in dropdowns in Connector templates #3682

Open
nloding opened this issue Jun 26, 2023 · 2 comments
Open

Allow conditional choices in dropdowns in Connector templates #3682

nloding opened this issue Jun 26, 2023 · 2 comments
Labels
backlog Queued in backlog element templates enhancement New feature or request spring cleaning Could be cleaned up one day

Comments

@nloding
Copy link

nloding commented Jun 26, 2023

Problem you would like to solve

Many REST APIs support multiple entities and operations, and trying to build out a larger base template is cumbersome currently. That leaves us with the option of a very messy and very hard to maintain JSON template (with some junk like what you see below), or not being able to support multiple operations in a single template.

Supporting conditional options in dropdowns makes the Connector templates easily maintained while still keeping the same flexibility. The example below is from experimenting with an AirTable Connector. AirTable's API supports multiple entity types that could be reasonably used within a workflow. To support all these currently, it is either a messy, hard to maintain template, or multiple templates.

    {
      "type": "Hidden",
      "value": "get",
      "binding": {
        "type": "zeebe:input",
        "name": "method"
      },
      "condition": {
        "property": "recordsEndpoints",
        "oneOf": [
          "listRecords",
          "getRecord"
        ]
      }
    },
    {
      "type": "Hidden",
      "value": "get",
      "binding": {
        "type": "zeebe:input",
        "name": "method"
      },
      "condition": {
        "property": "commentsEndpoints",
        "oneOf": [
          "listComments"
        ]
      }
    },
    {
      "type": "Hidden",
      "value": "get",
      "binding": {
        "type": "zeebe:input",
        "name": "method"
      },
      "condition": {
        "property": "basesEndpoints",
        "oneOf": [
          "getBaseSchema"
        ]
      }
    },

Proposed solution

Use the same condition syntax/property to make dropdown choices conditional. In the event that another property changes and hides (therefore invalidating) an existing selection in a dropdown, the dropdown could default to a null state (with nothing selected, similar to how dropdowns work if the template doesn't provide a default value).

"choices": [
  {
    "name": "Something",
    "value": "something"
  },
  {
    "name": "Something conditional",
    "value": "sometimesHidden",
    "condition": {
      "property": "aProperty",
      "equals": "hideThatOneOption"
    }
  }
]

Alternatives considered

An alternative that would achieve the same result is allowing multiple property keys to be used in conditions, but that seems more complex in the long run, both from a development perspective as well as a maintenance once.

Additional context

Related Slack threads: https://camunda.slack.com/archives/CKGH9LR40/p1686942106019649

@nloding nloding added the enhancement New feature or request label Jun 26, 2023
@philippfromme
Copy link
Contributor

Makes sense, thanks for opening this issue! 👍🏻

@smbea
Copy link
Contributor

smbea commented Aug 24, 2023

@smbea smbea self-assigned this Aug 24, 2023
smbea added a commit to bpmn-io/bpmn-js-element-templates that referenced this issue Aug 24, 2023
@nikku nikku added in progress Currently worked on and removed backlog Queued in backlog labels Aug 24, 2023
smbea added a commit to camunda/element-templates-json-schema that referenced this issue Aug 24, 2023
smbea added a commit to bpmn-io/bpmn-js-element-templates that referenced this issue Aug 25, 2023
@nikku nikku added the ready Ready to be worked on label Aug 27, 2023 — with bpmn-io-tasks
@nikku nikku removed the in progress Currently worked on label Aug 27, 2023
@smbea smbea added the backlog Queued in backlog label Sep 13, 2023 — with bpmn-io-tasks
@smbea smbea removed the ready Ready to be worked on label Sep 13, 2023
smbea added a commit to bpmn-io/bpmn-js-element-templates that referenced this issue Oct 10, 2023
@smbea smbea removed their assignment Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog element templates enhancement New feature or request spring cleaning Could be cleaned up one day
Projects
None yet
Development

No branches or pull requests

4 participants