snippets/data-in-processes/src/main/java/org/camunda/consulting/patterns/guard/Guards.java
public static void checkIsSet(final DelegateExecution execution, final String variableName) {
    checkArgument(variableName != null, VARIABLE_NAME_MUST_BE_NOT_NULL);

    final Object variableLocal = execution.getVariableLocal(variableName);
    final Object variable = execution.getVariable(variableName);

    checkState(variableLocal != null || variable != null,
        format(CONDITION_VIOLATED + "Variable '%s' is not set.", execution.getCurrentActivityId(), variableName));
  }
public static void checkIsSet(final DelegateExecution execution, final String variableName) {
    checkArgument(variableName != null, VARIABLE_NAME_MUST_BE_NOT_NULL);

    final Object variableLocal = execution.getVariableLocal(variableName);
    final Object variable = execution.getVariable(variableName);

    checkState(variableLocal != null || variable != null,
        format(CONDITION_VIOLATED + "Variable '%s' is not set.", execution.getCurrentActivityId(), variableName));
  }
Checks if a variable is set.

@param execution
current process execution
@param variableName
name of the variable.