Camunda Team Blog

Scripting with DMN inside BPMN

Written by Philipp Ossler on , under Community category.

In Camunda, you can use scripts at different places of a process. For example, inside a Script Task, as an execution/task listener, as a condition expression on a sequence flow or inside an input/output mapping. Usually, the scripts are written in JavaScript, Groovy or JUEL.

Using the FEEL extension, it is also possible to write scripts in FEEL (Friendly Enough Expression Language) which is a part of the DMN specification.

Why should I care about it?

Some highlights of FEEL are:

  • date and time calculations
  • useful list operations (e.g. filter, projection, all/at-least-one-test)
  • a lot of built-in functions
  • Camunda Spin integration

If you already use DMN then you are more or less familiar with FEEL. So you can use this knowledge to write scripts also in BPMN.

In general, it can be nice to have only one expression language for both: BPMN and DMN. This makes it easier to understand and modify the process and the involved decisions.


Assuming that you have the following order process

and the data model

class Order {
  private String id;
  private Date date;
  private List<OrderItem> items = new ArrayList<OrderItem>();

class OrderItem {
  private String id;
  private double price;
  private String status;
  private boolean inStock;

when you can implement the script task, the conditions and the multi-instance expression using the following FEEL expressions:

  • Check if all items are available:
every item in order.items satisfies item.status = "available"
  • Calculate the total price:
  • Select the items to fetch (as input parameter):
  • Check if the processing took more than 3 days:
now() - > duration("P3D")

Note that the expressions works in both cases: if the variable order is a regular Java object (i.e. default serialization) and if it is a Camunda Spin JSON object. You don’t need to transform the variable or use Spin in the expressions itself.

How to use it?

With the Camunda distribution

  • download the JAR from Github (feel-engine-plugin-1.5.0-complete.jar)
  • copy it to the lib folder of the Tomcat server
  • add the plugin to the process engine configuration (conf/bpm-platform.xml)
        <!-- ... -->    

With an embedded Camunda engine

  • add the extension as dependency to your project POM
  • register the plugin in your process engine configuration
<bean id="processEngineConfiguration" 
    <property name="processEnginePlugins">
           <!-- ... -->
           <bean class="org.camunda.feel.CamundaFeelEnginePlugin" />

Additional Information

You can find more information about the FEEL engine, the integration in Camunda BPM and examples on GitHub and the Wiki.