Array processing inside Condition expression

Hello, I am using Zeebe 1.7 version.

My payload has an array, I need to check that in a condition, trying all combinations, but it fails.

Actually two challenges I am facing -

  1. The variable name is @referredType, it is failing to recognize @symbol in the variable name.
  2. And the payload has has array of items, how to use that in the condition expression

My requirement is like this to put it in a condition expression -
interactionItem[0].item.@referredType == customer
interactionItem[1].item.@referredType == individual

Appreciate your response.

Hi @disharma, it doesn’t look like array dereferencing is supported in the JSONPath implementation in Zeebe. There are no examples of it in the documentation. Your JSONPath expression works on, but my diagram with:

interactionItem[0].item.@referredType == customer

as a condition refuses to deploy. The broker throws an error:

zeebe_1          | './bpmn/array-condition.bpmn': - Element: ServiceTask_16k3iut
zeebe_1          |     - ERROR: Must have exactly one zeebe:taskDefinition extension element
zeebe_1          | - Element: ServiceTask_0nf3bbk
zeebe_1          |     - ERROR: Must have exactly one zeebe:taskDefinition extension element
zeebe_1          | - Element: SequenceFlow_0t4soz9 > conditionExpression
zeebe_1          |     - ERROR: Condition expression is invalid: [1.16] failure: expected comparison operator ('==', '!=', '<', '<=', '>', '>=')
zeebe_1          | 
zeebe_1          | interactionItem[0].item.@referredType == customer

(Side note: This part of the Zeebe codebase is implemented in Scala.)

I would open a GitHub issue for this, and in the meantime work around it by lifting the part of the payload you need to examine to some part of the payload that is accessible via the JSONPath in Zeebe.

Thank you for your kind response, appreciate it.
I also wrote to zeebe and waiting for their response. Based on their confirmation, will raise a Github issue.

1 Like

I checked with @Zelldon in the Zeebe Slack - array dereferencing is not supported.

Here is an issue that was raised previously about it:

It reads to me that the reporter of that issue refactored the payload to lift the needed values to a key:value mapping.