Parsing a JSON inside DMN using FEEL script

Iam trying to fetch the data from json object directly using the feel script, but it throws an error
no variable found for name ‘eventId’"

payload:

{
“eventId”:“test”,
“postEventState”:“submitted”,
“state”:{
“nested”:“yes”
}
}

FEEL script:

Can someone help me on what iam doing wrong

Hi @harish1,

Below post might be of help to you

But Iam not using any java code inside my bpmn. Iam directly sending data in api body and then fetching it inside the DMN for processing.

Hi @harish1,

What is matter is to have a valid json variable regardless of the way it is created.

Could you please share the REST endpoint you call and the sent payload.

endpoint:
http://localhost:8080/engine-rest/process-definition/key/first-project-process/start
RequestBody:
{
“eventId”:“test”,
“postEventState”:“submitted”,
“state”:{
“nested”:“yes”
}
}

image

process.bpmn (2.2 KB)
test-dmn.dmn (2.3 KB)

Your request body should be as follow (Notice: variable name is called: jsonData)

{
    "variables": {
        "jsonData": {
            "value": "{\"eventId\":\"test\",\"postEventState\":\"submitted\",\"state\":{\"nested\":\"yes\"}}",
            "type": "Json"
        }
    }
}

It says Json is invalid
{
“type”: “InvalidRequestException”,
“message”: “Cannot instantiate process definition camunda-process:4:cce21c39-c98f-11ed-b628-00505691718c: Unsupported value type ‘Json’”,
“code”: null
}

Hi @harish1,

Please have a look at below docs

Thanks it worked.