I am new in Camunda and I am learning. I want to add a constant column either in the input or output section in Camunda Modeler. and I want to access this constant for some calculations and send the output.
In the below Camunda modeler, I have a column num (Expression: payload.num
) and a constant column constant (Expression: constant
). I want to send the output by the formula constant*payload.num
.
And here is my curl:
curl --location --request POST 'http://localhost:8080/engine-rest/engine/default/decision-definition/key/const_id/evaluate' \
--header 'Content-Type: application/json' \
--data-raw '{
"variables": {
"payload": {
"value": {
"num":1
}
}
}
}'
and I am getting this error: In Postman:
{
"type": "RestException",
"message": "Cannot evaluate decision const_id:9:6522be72-1cdd-11ee-adea-00ff092b2785: Exception while evaluating decision with key 'null'",
"code": 0
}
I want to output something like (without passing constant as input):
[
{
"output": {
"value": 5,
}
}
]
Error in Camunda Modeler CMD:
Caused by: org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression 'constant': no variable found for name 'constant'
Please help me where I am doing wrong, or How can I access constant column value either from Input or from one output's column to another output's column? Thanks in advance.
I explored and got the solution (workaround) to achieve this.
We can create the decision table like this:
In that decision table, we have two column names (expression -
payload.num
) as input and Constant (Expression -constant
) as output.The output will be input in one of the expression table (can call a decision table, but it will return an expression.)
Now, we need to create a decision table but in this, we will return an expression. the expression would be:
This is how we can call API in Postman and get the results: