0

I would like a conditional flow to depend on whether a JSON attribute (containing a JSON array of strings) contains a specific element.

The following expression works if the element is present, but throws an exception if it is not:

   <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
       ${ json_array.indexOf("foo")!=-1 } 
   </bpmn:conditionExpression>

The equivalent expression with lastIndexOf() also fails despite the documentation claiming that should not happen (issue 134).

Is there another way to do this?

Rasmus Faber
  • 48,631
  • 24
  • 141
  • 189

1 Answers1

0

This works, but seems rather clunky:

    <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
       ${ json_array.toString().contains("\"foo\"") } 
    </bpmn:conditionExpression>

I hope there is a better way.

Rasmus Faber
  • 48,631
  • 24
  • 141
  • 189