Feel Scripting - Debugging / Output Variables

Hi,

I’m currently encountering this error in a FEEL Script

10:54:14.802 [Test worker] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: condition script returns null: result is null
org.camunda.bpm.engine.exception.NullValueException: condition script returns null: result is null

So I would like to debug the script. The first thing I want to do is print the variables. How would I do that with FEEL? I have a feeling that the variable I’m using is null itself. println and print are not valid FEEL functions.

Have you tried using the on-line DMN Simulator? I wonder if that might give you more insight.

dg

1 Like

Hi @Raishad,

You can use this unit test template project

I am on the same team as Raishad, so I can add some context.
The script in use is actually part of a BPMN workflow, not a DMN table.

We have a gate where the non-default outflow arrow is a feel script of the form

every item in items satisfies
  not(item.isCondition)

items is of type java.util.ArrayList<CustomType>
CustomType is a fairly standard model that looks approximately like

@Data
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "@class")
public class CustomType {
  public String x;
  public String y;

  Boolean isCondition() {some logic}
}

We would like to be able to either connect the script to a debugger in IntelliJ, or add a print/log statement so we can look into the issue.

Thanks all.

Hi @Kyle_Hatfield,

Camunda BPM doesn’t support FEEL language.
Either Unified Expression Language (EL) JUEL or scripting languages supported by JSR-223 (Groovy, JavaScript, JRuby, Jython) can be used as conditions

https://docs.camunda.org/manual/7.15/user-guide/process-engine/expression-language/#conditions

https://docs.camunda.org/manual/7.15/user-guide/process-engine/scripting/#use-scripts-as-conditions

@hassang
Feel is a scripting language supported by JSR-223

So it should be able to be used in conditions.

Also there is a blog post from last year using Feel in Zeebee Using FEEL for Expressions - Part 1 - Camunda. Sadly there doesn’t seem to be a follow up, Part 2

Zeebe is different than Camunda Platform.
And yes, FEEL is supported in Zeebe and so in Camunda Cloud which is powered by Zeebe

As per Camunda docs,

Camunda Platform supports scripting with JSR-223 compatible script engine implementations. Currently we test the integration for Groovy, JavaScript, JRuby and Jython. To use a scripting engine it is necessary to add the corresponding jar to the classpath.

Hi @Raishad
I didn’t have the chance to use conditions as script. I used to use conditions as expression.
It is worth giving a try.

@Raishad, I believe you can utilize filter with Java lambda in a listener or a service task to evaluate your need and store the result in a boolean variable to be used in the condition.

Boolean result = (items.stream().filter(c -> !c.isCondition()).count() == items.size());

Edit:
I tried a Java List of String type and the below feel condition worked properly
every item in items satisfies (item = "A")

I believe that your problem is due to using a List of custom type so try the above suggested solution (utilizing filter with Java lambda)

1 Like