How to have input variable optional?

How to optionally send ‘last_name’?

My DMN setup pass with below input variable:
{
“variables”: {
“first_name”: { “value”:“And”, “type”:“string” },
“is_international”:{“value”:true, “type”:“boolean”},
“last_name”: { “value”:“And”, “type”:“string” }
}
}
But, fails with error: Exception while evaluating decision with key ‘null’ with below input
{
“variables”: {
“first_name”: { “value”:“And”, “type”:“string” },
“is_international”:{“value”:true, “type”:“boolean”}
}
}

Hi @Biz_Ready and welcome to the forum,

As far as I know, DMN does not support optional inputs.
If you use the decision from within a process, you can use an expression to set a default value.

Thank you and that helps. I have another new bee question.
If I use python or any other advanced language for the expression, can I import other libraries (let us say, to support rest call). Or only limited expression, and no complex integration.

Do you want to use Python for scripting decisions, or do you want to use Python for automating tasks in Camunda?

For task automation, you can implement external task workers with Python. This allows you to access the whole Python ecosystem. The community has developed clients, such as Pycamunda.
If you intend to use it directly in the engine, things become tricky (and I would not recommend including many dependencies). I haven’t used Python (Jython) for scripting in Camunda yet. With Groovy and JUEL you can access java classes and beans. Since Jython is interoperable with Java, I guess the same is possible. For Python libraries, you’d need to make them available from within the engine.

I want to use advanced language in decision scripting. Below are my examples.

  1. check on valid US states. I do not want to embed all states in the decision table, rather I would look up from a DB
  2. call rest endpoint if I need additional data that may not coming from input

In this case, I lack the necessary experience.
However, DMN Decisions should be stateless and site effect free. They are not intended to do REST calls or something similar.

I’d recommend a combination of DMN and BPMN (sometimes called a decision process):

  1. A task preceeding the decision may look up data from the database
  2. Then the first decision is called
  3. If necessary, a task calls a rest API and the next decision is triggered afterward

You can still embed this “decision process” into another process using call activities.
Or do you have strong reasons against the usage of BPMN?

Thanks for your response. We are trying to select right rule engine and came across of Camunda DMN implementation. Hence, BPMN is out of the scope.