Create a custom function to be called in FEEL/DMN


I would like to create a custom function that I can call in a DMN FEEL script.

I tried to follow the steps described in that documentation

But, when I try to call the “decr” function in my DMN rule, I still have the error message :

org.camunda.bpm.dmn.feel.impl.FeelException: failed to evaluate expression 'decr(var1)':
no function found with name 'decr' and 1 parameter

Would it be possible to have some help on that topic please ?

Is is my current setup :

  • Camunda engine running in a SpringBoot server

  • pom.xml contains Feel dependency :

  • Add this bean in the SpringBoot config :
    public ProcessEnginePlugin feelScalaPlugin() {
    return new CamundaFeelEnginePlugin();

  • Define the class as described in the doc :

public class CustomJavaFunctionProvider extends JavaFunctionProvider
private static final Map<String, JavaFunction> functions = new HashMap<>();

static {

    final JavaFunction function = new JavaFunction(Arrays.asList("x"), args -> {
        final ValNumber arg = (ValNumber) args.get(0);

        int x = arg.value().intValue();

        return new ValNumber(BigDecimal.valueOf(x - 1));

    functions.put("decr", function);

public Optional<JavaFunction> resolveFunction(String functionName)
    System.out.println("=====> resolveFunction with name=" + functionName);
    return Optional.ofNullable(functions.get(functionName));

public Collection<String> getFunctionNames() {
    System.out.println("=====> getFunctionNames ...");
    return functions.keySet();


Thanks for your help !