Hi,
I have created a process variable, which is basically an object when my service task is called, something of this kind:
{"0":{"time":"2020-05-01T12:48:50.963+05:30","previousValue":"set"},"2":{"time":"2020-05-01T12:48:50.963+05:30","previousValue":"reset"}}
and its type is JSONObject.
In the sequence flow I have a script task after the service task, where I am editing the process variable which i have created in my service task.
{"0":{"time":"2020-05-01T12:48:19.666+05:30","previousValue":"set","notificationTime":"2020-05-01T12:48:19.666+05:30","notificationTriggered":true},"2":{"time":"2020-05-01T12:48:50.963+05:30","previousValue":"reset"}}
and now when i see the type in cockpit, it is:
jdk.nashorn.api.scripting.ScriptObjectMirror<java.lang.String,java.lang.Object>jdk.nashorn.api.scripting.ScriptObjectMirror<java.lang.String,java.lang.Object>
This is how i am trying to manipulate my object in my script task:
var eventData= JSON.parse(execution.getProcessEngine().getRuntimeService().getVariable(execution.getVariable("rootId"),"mapOfEvents"));
var currentEvent = eventData[execution.getVariable("eventName")];
if (currentEvent["notificationTime"]) {
if ((new Date(currentEvent["notificationTime"]).getTime() + 180000) > new Date().getTime()) {
currentEvent["notificationTriggered"] = true;
currentEvent["notificationTime"] = currentEvent["time"];
} else {
currentEvent["notificationTriggered"] = false
}
} else {
currentEvent["notificationTime"] = currentEvent["time"];
currentEvent["notificationTriggered"] = true;
}
currentEvent["time"]=new Date();
eventData[execution.getVariable("eventName")] = currentEvent;
execution.getProcessEngine().getRuntimeService().setVariable(execution.getVariable("rootId"),"mapOfEvents", eventData);
When i click the deserialized tab in cockpit after updating the processvariable, this is the error i am able to see:
**Deserialization Error:** Cannot deserialize object in variable 'mapOfEvents': SPIN/JACKSON-JSON-01007 Cannot construct java type from string 'jdk.nashorn.api.scripting.ScriptObjectMirror<java.lang.String,java.lang.Object>'
Now when I am trying to access the process variable inside service task(java class) I am getting the following error.
org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: ENGINE-03040 No serializer defined for variable instance 'org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField@70d3b824'
Thanks In Advance