'Camunda parse date from JavaScript-Date

Trying to parse the date-string in Camunda-Javascript I get the following error:

org.camunda.bpm.engine.ProcessEngineException: Cannot serialize object in variable 'xy': SPIN/DOM-XML-01030 Cannot create context

Trying to return only a Date the error is also thrown:

enter image description here

returning only the String it gets interpret as "String":

json.briefdatum;

enter image description here

So how can I return the date-string as "Camunda"-Date?



Solution 1:[1]

So, after a long time of experimenting I found the solution:

var json = JSON.parse(response);
var pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSS";
var mydate= json.mydate;
briefdatum ? new java.text.SimpleDateFormat(pattern).parse(mydate) : "";

This JavaScript in output parameter of the http-connector parses the date (if present).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SNO