Closed saig0 closed 6 months ago
Via context
Avoid exposing variables that have the same name as list properties (i.e. no variable loanId
).
Via expression
Instead of accessing the list properties directly, use the filter variable item
to access the properties. See the following example.
sum({"loans" : [
{"loanId" : "AAA001", "amount" : 10},
{"loanId" : "AAA002", "amount" : 20},
{"loanId" : "AAA001", "amount" : 50}
]}.loans[item.loanId = id].amount)
Describe the bug
A filter expression can access the properties of a list item by the property name. In the following example, the list is filtered by the property
loanId
. The variableid
is provided by the context.Since version
1.16.2
, the FEEL engine evaluates the expression differently if the context contains a variableloanId
. The propertyloanId
gets overridden by the variableloanId
. It seems to be an issue with the variable resolution.This issue happens only if the context is provided by a custom context (i.e. not a static context). This is the case with the integration in Zeebe.
To Reproduce Use the following test case of the FEEL engine to reproduce the issue:
Expected behavior In a list filter expression, the properties of a list item are not overridden by the context.
Environment
1.16.2
8.2.18
https://github.com/camunda/zeebe/issues/15321