How to take inputs from DB for creating rules in DMN

I have one use case where the user has to select from multiple options for the input to evaluate the rule. Rather than creating options as predefined values, I want those values to come from DB like Postgres or MySQL. Any suggestions on that?

2 Likes

I’m not sure if it is possible that before the decision making point, You call a external service task, Query your data from DB, and then add a variable containing your data to the process object in that external service. Then you can access it via the expression.

As @Meysam_Karimi suggested, the cleanest way to do this would be to put a BPMN around the DMN, with a User Task “Collect Data” before the “Evaluate Business Rule” (DMN) task.

You would likely use a form for that User Task, which can then be populated/validated from values in a business system

1 Like

I have a DMN table with input fields that have more than 1000 options. Currently, we are manually adding these options one by one. Is there any way to add the entire list of input options in one go?

Building a DMN from DB options isn’t quite what I understood the issue to be…

I was understanding that it was the user input that you were looking for a picklist from a DB. DMN should be pretty consistent - once it’s deployed, that’s the rules. Remember that you can use wildcards in your DMN to cover “else” cases.

Since DMN is just xml you can create it programmatically. Camunda offers an API for this: Create a Model | docs.camunda.org . This way you could read your data from a database, create the DMN on the fly and deploy it to the engine.