Trisotech's blog post - Custom FEEL Functions
Trisotech Icon
Blog

Custom FEEL Functions

By Trisotech

Read Time: 4 Minutes

The Friendly Enough Expression Language (FEEL) from the Decision Model and Notation (DMN) comes with a series of standard built-in functions.

These pre-defined functions provide a convenient and standardized way of performing certain operations or calculation. These save FEEL users from having to define their own functions or write complex expressions to perform common tasks. Instead, they can simply use the built-in functions, which are typically well-documented and easy to use. The FEEL built-in functions are a central part of the Trisotech platform as FEEL is the default expression language used in not only DMN, but BPMN and CMMN as well.

The OMG DMN standard defines a library of over 100 built-in functions for working with strings, lists, dates and times, ranges, temporal constructs, sorting and many more. While these are required and very useful, there are many reasons why users may want to add additional functions beyond the built-in functions that are provided by default.

These include:
  • To provide additional functionality that is not covered by the built-in functions.
  • To improve performance or efficiency.
  • To make the language more user-friendly or easier to use.

Trisotech provides a simple to use feature to augment the basic list of FEEL built-in functions provided by DMN in a standardized way. These added [custom] FEEL functions that save time and effort when writing FEEL expressions and provide a consistent and standardized way to perform common operations.

Where to Find the Custom Libraries and Functions

The added functions are available in the Decision, Workflow and Case modelers via custom libraries that can be included from the Learn ribbon of the modelers. A custom FEEL library can be included into a model by selecting it from the Custom dropdown menu.

When a library is selected, its icon becomes available in the ribbon with its own dropdown menu. Custom FEEL libraries include Automation, Financial, Healthcare, Non null and Utilities and many more.

Using a Custom FEEL Function

Custom FEEL functions can be used in any FEEL expression just like the built-in functions.

Let’s walk through an example of using the custom function “utility.to epoch”.

Below is a simple DMN DRD that takes a Date and Time as an input and provides the Epoch time (the number of milliseconds since January 1, 1970, a typical UNIX time field) for that Date and Time in return.

Trisotech Custom FEEL Function In-modeler Documentation

All the custom FEEL functions are documented in the modeler. Simply click on any of the library dropdown from the Learn ribbon to see that documentation. Here is the utility.to epoch function description.

Adding a Custom FEEL Function

In our example we have defined the decision output type as Number and the decision logic as a Literal Expression. By clicking on the Literal Expression symbol in the top left of the Decision shape we are taken to the decision logic screen where we can enter the Literal Expression. If we type the first few characters of our function name, autocomplete presents us with known choices. Below we type “ut” and the extended utility functions drop down.

We click on utility.to epoch and autocomplete fills the expression field with our function.

Next, we begin typing our input name “Dat” and autocomplete shows our choices where we select “Date and Time” from the dropdown.

Autocomplete then fills in our entry.

Testing the Custom Function

Using the Test feature from the modeler’s Execution menu brings up the input fields we defined for the Date and Time input shape.

The input Date and Time asks for three values date, time, and time zone.

The test feature provides dropdowns for date (shown), as well as time and time zone.

Here we see the completed input fields.

Finally, when we click the Submit button, the result of the “utility.to epoch” function is returned.

Managing the Custom Libraries

The custom libraries can be managed from the DMN ribbon menu item “Custom FEEL functions”.

Libraries can be removed from or added to the current model by using the “x“ or “+” buttons respectively.

Conclusions

Trisotech provides many additional custom functions that can be added to the FEEL expression language. These functions expand the power of FEEL while making it easier to use and the logic simpler to understand. The custom FEEL functions are provided in logical libraries which can be selectively added to (or removed from) specific models and behave just as the build-in FEEL functions of DMN including autocomplete and in-modeler documentation within the modelers.

To see a short video of this subject, click here.

All Blog Articles

Read our experts’ blog

View all

Learn how it works

Request Demo

Confirm your budget

Request Pricing

Discuss your project

Request Meeting
Graph