How to handle optional task input variable

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)

Hi @Eetay!

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:

I recommend to initialize all variable with null. In a FEEL expression, you can check if a variable is null (e.g. 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"

Best regards,

Thanks @philipp.ossler!