Hello Zeebe team!
I’m looking to have a task with input from global variable which may or may not be defined
and I have a default value
Is there a FEEL expression function capable of handling such case
e.g. in mapping have expression like so:
=if defined(x) then x else “defaultValue”
P.S. is there a topic on Designer and FEEL? couldn’t find suitable topic, put this on “Zeebe Broker” (closest)
That is an interesting questions. Currently, there is no easy way to test if a variable is present or not. There is an open issue to handle this case: https://github.com/zeebe-io/zeebe/issues/4212
I recommend to initialize all variable with
null. In a FEEL expression, you can check if a variable is
if(x = null) then "default" else x).
Alternatively, you could also check if the variable has a specific type. For example:
if(x instance of string) then x "default"