FEEL expression for ternary operator

Hi Everyone,

Does camunda-8 support feel expression for ternary operator?

TIA.

Hi @yadav1990 - I don’t believe the FEEL spec supports ternary operators, but you can use a standard if/then/else statement. Our docs cover it here under the “Control Flow” section. So instead of writing 5 < 10 ? 'low' : 'high', your FEEL expression would be if 5 < 10 then 'low' else 'high'

1 Like

Thanks @nathan.loding does it support nested if else statement.

@yadav1990 - yes, you should be able to nest them. If you haven’t tried it yet, this FEEL Playground is very helpful for testing expressions:

1 Like

Thanks for sharing the FEEL playground to test feel expression.
I am facing one issue while defining the script task implementation as FEEL expression. so could you please assist on this issue. I am just included zeebe client dependency in my spring boo app.

Command 'CREATE' rejected with code 'INVALID_ARGUMENT': Expected to deploy new resources, but encountered the following errors:
'qrph-u2u-payment.bpmn': - Element: Activity_116f1yl
    - ERROR: Must have exactly one 'zeebe:taskDefinition' extension element
- Element: Activity_1ugn2zh
    - ERROR: Must have exactly one 'zeebe:taskDefinition' extension element
 [ deploy-error ]

Below is our script task configuration:

TIA.

Thanks, @lzgabel Please find the sample scriptTask which I am trying to deploy.
new-bpmn-diagram (3).bpmn (2.6 KB)

Could you please check now?

TIA.

Hi @yadav1990. Please provide your original process model, the one you provided works fine.

Hi @lzgabel . This is the original BPMN flow that I am trying to use FEEL for script task and I have no taskDefinition.

the one you provided works fine so, did you apply some magic? :thinking:

What is your environment setup? am I doing anything wrong?

Below are the xml version of this BPMN

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.10.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.2.0" camunda:diagramRelationId="7b0f7803-08fe-4d50-b4ca-8014a212100e">
  <bpmn:process id="Process_11309045-4c32-4c91-9561-3fd8e41fa3b9" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>Flow_1dnrj9p</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:sequenceFlow id="Flow_1dnrj9p" sourceRef="StartEvent_1" targetRef="TEST" />
    <bpmn:endEvent id="Event_1glacqm">
      <bpmn:incoming>Flow_0w71k1y</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_0w71k1y" sourceRef="TEST" targetRef="Event_1glacqm" />
    <bpmn:scriptTask id="TEST" name="Test">
      <bpmn:extensionElements>
        <zeebe:script expression="=if 1=1 then&#10;  {&#34;msg&#34;:&#34;hello&#34;}&#10;else&#10;  {&#34;msg&#34;:&#34;hi&#34;}" resultVariable="resultantaData" />
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_1dnrj9p</bpmn:incoming>
      <bpmn:outgoing>Flow_0w71k1y</bpmn:outgoing>
    </bpmn:scriptTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_11309045-4c32-4c91-9561-3fd8e41fa3b9">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="150" y="100" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1glacqm_di" bpmnElement="Event_1glacqm">
        <dc:Bounds x="402" y="100" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_159sp6e_di" bpmnElement="TEST">
        <dc:Bounds x="240" y="78" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_1dnrj9p_di" bpmnElement="Flow_1dnrj9p">
        <di:waypoint x="186" y="118" />
        <di:waypoint x="240" y="118" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0w71k1y_di" bpmnElement="Flow_0w71k1y">
        <di:waypoint x="340" y="118" />
        <di:waypoint x="402" y="118" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Hi @yadav1990. :bow:
I’m very sorry, I misunderstood, what is your current broker version? ScriptTask using FEEL expression are available after 8.2.0-alpha1

hi @lzgabel. Thanks confirming the issue. The current version of broker is “8.1.13”.

could you please tell me the latest stable version of broker which can I used in enterprise?

TIA.