DMN: Create a custom function

Hi everyone,

I’m trying to find some help with custom functions for DMN engine. So, I’m using the flowable-spring-boot-starter-rest and I’m trying to execute a DMN rule with a custom function.

I created my custom function NextBusinessDay:

public class NextBusinessDay extends AbstractFlowableFunctionDelegate {

    public NextBusinessDay() {

    public String prefix() {
        return "dates";

    public String localName() {
        return "nextBusinessDay";

    public Class<?> functionClass() {
        return DateUtils.class;

    public Method functionMethod() {
        return getSingleObjectParameterMethod("nextBusinessDay");

This is the static method that I aims to be called:

public class DateUtils {

    public static Date nextBusinessDay(Date d) {
        return org.apache.commons.lang3.time.DateUtils.addDays(d, 5);


Here is my DMN engine setup where I have already deployed a DMN table and added my custom function NextBusinessDay.

public class DmnEngineSetup {
    private DmnEngine engine;
    private URL url = getClass().getResource("/dmn");
    private List<FlowableFunctionDelegate> flowableFunctionDelegateList =
            Arrays.asList(new NextBusinessDay());

    public void deploy() throws URISyntaxException, IOException {

        Path path = Paths.get(url.toURI());
        Files.list(path).forEach(p -> {
                    .addClasspathResource("dmn/" + p.getFileName().toString())


Finally, I have my DMN definition using my custom function:

<definitions xmlns="" id="definition_afbe03b6-6604-11eb-bbcf-0242ac110002" name="Next Business Day" namespace="">
  <decision id="nextBusinessDay" name="Next Business Day">
    <decisionTable id="decisionTable_afbe03b6-6604-11eb-bbcf-0242ac110002" hitPolicy="FIRST">
      <input label="Date">
        <inputExpression id="inputExpression_1" typeRef="date">
      <output id="outputExpression_2" label="Next Business Day" name="nextBusinessDay" typeRef="date"></output>
        <inputEntry id="inputEntry_1_1">
        <outputEntry id="outputEntry_2_1">

Thus when I try to execute the rule I get an error that says: “Could not resolve function ‘dates:nextBusinessDay’”

Bruno Alves


problem seems that you’re setting the customFlowableFunctionDelegates after the DMN engine is initialised.
If you want to use the customFlowableFunctionDelegates then you need to do it before initialisation because this is used to build up a collection FlowableFunctionDelegates. (The build in ones plus the custom ones).

Please try a @configuration class like this one;

public class DmnEngineSetup {

    public EngineConfigurationConfigurer<SpringDmnEngineConfiguration> customDmnConfigurer() {

        return configuration -> {
            if (configuration.getCustomFlowableFunctionDelegates() == null) {
                configuration.setCustomFlowableFunctionDelegates(Collections.singletonList(new NextBusinessDay()));
            } else {
                configuration.getCustomFlowableFunctionDelegates().addAll(Collections.singletonList(new NextBusinessDay()));

This adds the NextbusinessDay custom function delegate to the DmnEngineConfiguration before engine initialisation.




Thank you for the response!
This solves the problem :grinning: