Programmatic Management of DMN Tables


Does anyone know if there’s a relatively easy way to create and manage DMN tables programmatically?

For example, I create and deploy a DMN table as usual. I then want to add a rule to it without going through Modeler or the Cockpit GUI. In other words, I want to treat it sort of like a database table where I can add, insert, modify, etc. without having to point and click through a graphical interface or manually modify the underlying XML. I should emphasize that I want to do this in the Camunda server itself, not separately and then redeploy it.

The Java docs don’t make it clear if you can do this or not. I do realize that I could crack open the library as that obviously has the ability to hook into existing tables. But I was hoping there was an easier way.




Im looking into this myself. The approach Im taking is to get the DMN XML model via an API, use an XML library (eg Spin) to add rules to the model, then redeploy using an API.

Does this sound like it would work for you?




Yeah, I knew I could do that. If we break open something like the Excel to DMN converter, we would see how the tables are constructed and go from there. I suppose conceptually it wouldn’t matter.

Moreover, what would one do if the DMN table were scattered amongst disconnected Camunda instances? It’s probably better to pull a master, modify, validate, and push. If you automate all that, which isn’t terribly difficult, then from a user standpoint it wouldn’t matter whether you did it via a fancy, local Java API call or just rebuilt the thing in one place and deployed it via the REST interface.

We were speculating about what it would take to build a database to DMN dynamic interface where the DMN would be backed by a database which you could manipulate with all the available tools,but which the engine could use to do its evaluation. That’s probably a stupid idea given the caching and optimization Camunda have already done.

However, I told my boss I would investigate what could be done programmatically. Our challenge is that you can’t restrict a user to modification of individual rules through the Camunda authorization system. Therefore, we’d have to build a front end that allow them only to modify rules that they should have access to. And yes, I know, we could create separate tables and secure each resource, but then you have a “normalization” problem where you have 20 tables all containing the same type of data and rules, divided up just for access control.

My Java and EE knowledge isn’t anywhere near what yours is, but my intuition says something like this should be possible. I just wondered if Camunda had already done something to facilitate it.


Hi guys,

Similar to BPMN and CMMN, there is the DMN model API for Java. It is undocumented at this time aside from Javadoc (follow That is also what the Excel-to-DMN converter uses. The principles it works by are the same as in the BPMN and CMMN model APIs. There is no fluent builder, though. The entry class is org.camunda.bpm.model.dmn.Dmn.



Maven coordinates:



Hello Michael and Rob,

to fill the gap from the missing documentation I attach and example I built a while ago: (6.4 KB)

It’s a simple java main method and creates a decison table from scratch. In the end, the decision is evaluated.

Hope this helps,



Does the model support “on-the-fly” modification of existing, deployed, DMN table? Or, must we modify it separately and redeploy it? I suppose the there’s little difference here in terms of the effect it has.


You have to catch the table from the deployment, create a model from it (Dmn.createModelFromInputStream()), change it and redeploy it to the engine.

There is no API to change to the model on the fly.


Das freut mich nicht! =-(

(Not sure I got the article correct here, it’s been 30 years since I’ve used my German daily).


Your German is correct.

To do this completely automatically, your can build a process that changes the dmn table (read it, change it, deploy it) and start this process either by a timer start event or by some message event, that gets fired if your database table changes (which would be much more work to do).


Yup, this is precisely what Im doing apart from I was using XML DOM manipulation over an API based model builder…




I’m working on a PHP solution:

Feel free to use it or improve it :slight_smile:


We have code to programmatically alter a DMN table file via the Java API. However, as I learned, you cannot alter an active DMN table dynamically. You must download the table, modify it, then upload the new version.

Good luck with your PHP solution, however.