DMN Invoice Example Included in 7.4.0-alpha3-ee (How do we use DMN?)

712 views
Skip to first unread message

mp4...@att.com

unread,
Nov 24, 2015, 1:38:10 PM11/24/15
to camunda BPM users
I cannot find the source code for the Invoice example application shipped with the latest 7.4.0-alpha3-ee release.

The code shipped uses a Business Rule Task to determine the approver. The only code related to the Invoice example that I can find uses a User Task.

This is important to me because there is no clear (not fragments of detail found in multiple locations) explanation of how to use the DMN integration, so I realize I'll have to figure it out myself.

Having a single, unified example that shows the following would be helpful:

- Simple DMN table structure
- Input of variables into the DMN engine without the use of HTML forms
- Output of the result from the DMN engine

I don't understand how this all bolts together. The Insurance application doesn't work because it throws the following error:

DMN-01002 Unable to evaluate expression for language 'juel': '${application.applicant.age}'

I realize you are still working on DMN integration, but this is critical to my project and I'm hoping I don't need to go to an external DMN engine (e.g., OpenL Tablets), but if you don't think the DMN integration is really ready, I'll go that route.

Thank you.

webcyberrob

unread,
Nov 24, 2015, 4:14:53 PM11/24/15
to camunda BPM users, mp4...@att.com
Hi,

The source for the example can be found here:


The DMN file is here:


In the BPMN file, there is a business rule task. It is linked to the DMN engine vi reference to the decision table. 

I hope this gets you started,

regards

Rob

PEOPLES, MICHAEL P

unread,
Nov 24, 2015, 6:29:54 PM11/24/15
to camunda-...@googlegroups.com

Sadly, I’ve already grabbed that code and it does not contain a Business Rule task.  The approveInvoice task is a userTask.  I also have the DMN file as I was able to download it from the Camunda server via the DMN tooling there.  Also, while having the example would be helpful, my use case involves no human interaction, so the forms piece just muddles this for me a bit.

 

The DMN integration at the server level seems to be very good and easy to use.  They’ve done a good job on this initial implementation. 

 

I realize that I’m asking to be “spoon fed” an example.  However, if Camunda want their product to gain wider use, they need to do a better job with noobs like me.  I just wish I could figure out how to use it without all the tedious detective work.  

 

Thank you for trying to help me, however.

 

Michael Peoples (mp4783)

AT&T Network Operations

Network Operations Centers Planning

Office: +1 614-886-0923

Mobile: +1 614-886-0923

 

Principal Applications Developer

mp4...@att.com

--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/767GcVv0lCA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/59c6c149-3e1e-4b64-9ab6-8de6502a0db6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

webcyberrob

unread,
Nov 24, 2015, 8:51:59 PM11/24/15
to camunda BPM users, mp4...@att.com
Hi Michale,

Happy to help you a little more!

There is probably some 'secret sauce' to be aware of. The examples often use process instance variables. These are name/value pairs bound to a particular process instance. Hence if you start a process via a form, or you have a user task somewhere is the process, often these will create, read or update process instance variables. Because this is a common pattern, there are a lot of convenience features built in. For example when using forms, you can use the cam-variable directive which means the forms SDK will take care of reading and writing process instance variables for you. Likewise, for service tasks, connectors and even DMN rules, you may often see use of Java Unified Expression Language (JUEL) via expression such as ${Customer.order} - again this is declarative and behind the scenes will be looking for a process variable called Customer and calling a method called order(). ANyway enough of the secret sauce.

Lets look at this example;

There is a start event with a link to an embedded form (camunda:formKey="embedded:app:forms/start-form.html") Hence in looking at the HTML of the form, the following fields are defined;

creditor
amount
invoiceCategory
invoiceNumber
invoiceDocument

Hence on form submission, these values will be stored as process instance variables using the names as defined in the form. You don't have to use a form. If you look at the REST API documentation, you can start a process instance via a REST API and pass in variables will will become process instance variables.

After the start event is a business rule task which applies the DMN rules. In looking at the DMN rules, there are three rules for an amount under $500, amount under $800 and travel category and amount over $800. The hit policy on the rule table indicates (R)ulr Order which means multiple rules could be applicable and thus the result may be a set of results. In addition, the DMN inputs names will attempt to find the same names as process instance variables, hence the process instance varaiables provide the glue between the form submission and the DMN rules, in particular variables amount and invoiceCategory. The business rule task in the BPMN file looks like this;

<businessRuleTask id="assignApprover" camunda:decisionRef="invoice-assign-approver" name="Assign Approver Group" camunda:mapDecisionResult="collectEntries" camunda:resultVariable="approverGroups"> <incoming>SequenceFlow_1</incoming> <outgoing>sequenceFlow_178</outgoing> </businessRuleTask>

Hence the decisionRef identifies the DMN table ID so the DMN engine knows which decision table to run. The output of the decison will go into a process instance variable called aproverGroups. The purpose of the businmess rule task is not to assign an individual, it just determines which group the individual must belong to in order to have access to the user task where the approval actually happens.

I hope this gets you going, feel free to ask more questions in the forum.

I am sure that as soon as the DMN release goes final, you will find more material, examples and tutorials...

regards

Rob

Bernd Rücker

unread,
Nov 25, 2015, 2:55:46 AM11/25/15
to camunda-...@googlegroups.com, mp4...@att.com

Please note that https://github.com/camunda/camunda-consulting/tree/master/showcases/en/invoice/ is a different showcase used within our BPMN trainings for demos WITHOUT DMN. The Link gave you is correct.

--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.

Sebastian Menski

unread,
Nov 25, 2015, 3:58:59 AM11/25/15
to camunda BPM users, mp4...@att.com
Hi Michael,

as Rob and Bernd pointed out the example ist part of the camunda-bpm-platform repository on GitHub [1]. It uses a start form to set 5 process variables:

- creditor
- amount
- invoiceCategory
- invoiceNumber
- invoiceDocument

Also it includes test cases [2] which starts the process using normal Java API. 

I'm currently working on the missing DMN documentation. And I hope that it will be complete next monday when we release the
final 7.4.0 version.

During this I also created a first example which demonstrates how to use the DMN engine standalone without BPMN [3]. Not sure
if this helps you. But please not this example already uses the 7.4.0 version. So if you want to test it please change the version
to 7.4.0-alpha3 in the pom.xml [4].

Cheers,
Sebastian

Bernd Rücker

unread,
Nov 25, 2015, 11:06:48 AM11/25/15
to camunda-...@googlegroups.com, mp4...@att.com

There is an example available not using any BPMN but just the pure DMN engine in a stateless manner: https://github.com/camunda/camunda-bpm-examples/tree/master/dmn-engine/dmn-engine-java-main-method. Maybe that is interesting as well?

 

Von: camunda-...@googlegroups.com [mailto:camunda-...@googlegroups.com] Im Auftrag von webcyberrob


Gesendet: Mittwoch, 25. November 2015 02:52
An: camunda BPM users <camunda-...@googlegroups.com>
Cc: mp4...@att.com

--

You received this message because you are subscribed to the Google Groups "camunda BPM users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.


To post to this group, send email to camunda-...@googlegroups.com.

PEOPLES, MICHAEL P

unread,
Nov 25, 2015, 12:14:45 PM11/25/15
to Bernd Rücker, camunda-...@googlegroups.com

I’m sort of starting to get this, although there is no exact example that shows what I want to do.  Both the Invoice and Insurance examples use methods that don’t seem to exactly fit.

 

Invoice uses an HTML form for input.  The output of the DMN table is mapped to a preconfigured attribute (Candidate Groups) of the “Approve Invoice” user task.  In my case, the next task is a service task that doesn’t have such an attribute, so I’ll assume that result will just be “generally” available within the process itself.  What is interesting here is the use of the mapDecisionResult attribute, whose use I don’t understand.  It appears to be used with “cam” variables set within the HTML document.

 

Insurance application uses an external MapDmnResult class in the executionListener attribute.  I think I understand what that is doing in that it is providing a method to handle DMN results from two different types of outputs (DMN output and the result variable of the business tasks).

 

What I’m trying to do is very simple.  I will present the DMN table with a set of inputs which will result in either null or a single result output.  I want to then use that output further along in my process.  I am, at present, assuming that all I need to do is set the “Result Variable” attribute and then I can use that to represent the result output by the DMN table.  If this is incorrect, then let me know.

 

Again, I appreciate your response at a time when you are trying to get this major enhancement to Camunda out the door.

 

Michael Peoples (mp4783)

AT&T Network Operations

Network Operations Centers Planning

Office: +1 614-886-0923

Mobile: +1 614-886-0923

 

Principal Applications Developer

mp4...@att.com

 

Reply all
Reply to author
Forward
0 new messages