Extending the Functionality of a Decision Model - Gnorion/BizVR GitHub Wiki

While the decision table handles most situations for rule modeling, there are times when you need extra functionality.

There are several ways to add this.

The first is just to add an expression box and then use the FEEL language to code the extra functionality.

But there are other options

Import an existing decision into yours (as a BKM)

This might be a decision model that you wrote or one that someone else wrote.

image

Once its imported into your decision you can invoke it as if it were a built in function

Make a REST call to some external function

You could do something as simple as this

curl -X GET "https://jsonplaceholder.typicode.com/posts/1"

Which will return a test response in json format like this

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit..."
}

Use a language other than FEEL in the expression box

For example by selecting "python" as the expression language you could write

import requests
url = "https://jsonplaceholder.typicode.com/posts/1" # The URL of the API endpoint
response = requests.get(url)                         # Send a GET request to the API
if response.status_code == 200:                      # Check if the request was successful (status code 200)
    data = response.json()
    print(data)                                      # Print the JSON response from the API
else:
    print(f"Failed to retrieve data: {response.status_code}")

Or if you select Ruby as the language:

require 'net/http'
puts Net::HTTP.get(URI('https://jsonplaceholder.typicode.com/posts/1'))

Use the (non-standard) invoke function in FEEL

This is only for invoking other DMN models

image

Summary

image

Sample Model