Flowable UI - (Decision table DMN) - Not able to access elements inside a list of Employee objects

Hi,

I’m currently using flowable modeler and have been able to achieve most of my solution.
However, I have a use case in which I’m trying to use decision table. It is basically to validate the datta being passed from the POST API (custom API).

The object is as below:
{
“id”: “1”,
“entityName”: “ABC”,
“lastName”: “Ltd”,
“email”: “abc@abccom”,
“associatedParties”: [
{
“id”: “2”,
“name”: “test”,
“email”: “test@testcom”,
“age”: 19
},

{
“id”: “3”,
“name”: “test”,
“email”: “test@test.com”,
“age”: 19
}, …
]
}

Basically, I want to check in decision table that the ‘email’ under ‘associatedParties’ is not empty or not a ‘particular’ email in any of the index. Not been able to figure out this.

Could anyone please help accessing email under nested employee object(associatedParties) for any number of index in the list. i.e: I do not want to specify the index and it should apply to all the elements in the array/list

I’m looking for something like : {data.associatedParties.[*].email != ‘abc@abc.com’}

@yvo @joram Are you able to suggest me a potential solution here please.

Hi,

have a look at Custom Function Delegates Configuration · Flowable Open Source Documentation
With this you can plugin your own logic if the provided functions do not suffice.

btw
No need to ping other forum members directly in topics and in addition to that send direct messages to them. That does not help.

Regards,

Yvo

Hi Yvo,

Sorry about that.
I’m programmatically deploying my DMNs, not sure if StandaloneDmnEngineConfiguration would be suitable.
Also, as I do not have XML based spring container- is there an example which I can follow which has the spring boot based example.

I was wondering if there was a solution out of the box for iterating array elements and validating their values.

Apologies again.

Update:
I have tried as you suggested, please see sam ecode below:

@Configuration
public class DmnEngineSetup {

@Bean
public EngineConfigurationConfigurer<SpringDmnEngineConfiguration> customDmnConfigurer() {

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

}


public class ListElementsValidator extends AbstractFlowableFunctionDelegate {

public ListElementsValidator() {
}

@Override
public String prefix() {
    return "list:";
}

@Override
public String localName() {
    return "validateElement";
}

@Override
public Class<?> functionClass() {
    return ListValidatorUtils.class;
}

@Override
public Method functionMethod() {
    return getSingleObjectParameterMethod("validateElement");
}

}

___-------------------------------------

public class ListValidatorUtils {

public static boolean validateElement() {
    return true;
}

}

Can you please suggest me as to how to refer it in decision table. I tried a few combinations but when I run the process, it throws the following exception:

Error: DMN decision with key employer_dataset execution failed. Cause: Could not resolve function ‘list:validateElement’

Hi,

no worries.

Iterating over multi level nested objects is not support OOTB. But that can be added with these Custom Function Delegates (I mentioned in my previous reply)

Have a look at the source code for some examples on this.

Yvo

Thanks.
Sorry, I had modified my previous post with the code snippets, you might not have seen it.

Do you have a sample dmn which shows as to how to use the custom code.

Have a look at this test;

And the DMN that is related to it.

Yvo

1 Like