How to check for null values for Harness variables?

Summary:
To have a check inside Harness workflows for the JEXL variables like workflow variable, service variable or context variable used in Harness for a null value.

This check can be implemented by a JEXL method to check for null values, i.e. empty()

Having checks for null value would be beneficial:

  • When values for the variable are generated during the workflow run time and for better error handling it can be used

  • To have conditional execution of steps and phase base on condition, for example a variable has null value then skip this respective step/phase

Following are examples of how to check for null values inside the Harness workflow:

1 Like