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
Hi @Vamshidhar_Reddy_Chi ,
Assuming CaseField is a variable of json type
[image]
Below snip shows how to use json variable
// define a JSON variable
SpinJsonNode json = Spin.JSON("{\"customer\": \"Kermit\", \"language\": \"en\"}");
// create a variable map and store the JSON variable
VariableMap variables = Variables.createVariables().putValue("jsonVariable", json);
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”
}
}
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"
}
}
}
hassang:
{
"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