Error extracting date values from JSON process variable property

Hi Camunda community,

I should start by describing our setup. We’re using the Camunda 7 remote engine and a Java 11 app that uses the Camunda REST and External Task client libs for Camunda API calls in our services and polling for topics for our external task workers to process. In our Java app, we have a service that is used to start a deployed process by first creating the initial variable map and then launching via Camunda API call with that map and name of the process.

For any process variable that is not a primitive type in Camunda, ie. a complex object that has a model in our Java app but not on the Camunda pod(s), we’re serializing those to JSON before adding to a VariableValueDto to put into the map with the type set to “json”.

The issue we’re having is trying to get a date property out of one of the JSON objects in an input expression for one of our Business Rule Tasks in our BPMN model. Our Java app internal classes all use java.time date values – LocalDate for dates and OffsetDateTime for date-times – but we cannot read the LocalDate property as a date input, or even a string input, when trying to access that value in either an Input expression or as the expression in the Input column itself.

For example, when trying to use this expression in the input column in the DMN:
date(review.createdDate)

I get this error in the Camunda container logs:
Suppressed failure: illegal arguments: List(ValList(List(ValNumber(2022), ValNumber(11), ValNumber(21))))

The input expression on the Business Rule task also doesn’t work:
${review.props("createdDate")}

And the resulting value of the input column in the DMN associated with the Business Rule task is always null.

Is this something that should be fixed in our Jackson ObjectMapper before serializing the java.time dates? Or is there a way for the EL to interpret these properties correctly without modifying the ObjectMapper config?

Thanks for your help!

1 Like

Following up with our workaround solution:
Serialize LocalDate and OffsetDateTime to ISO-formatted strings, which the FEEL date() and date and time() methods can parse and reconstruct the date in that way. ${LocalDate.parse(dateVariable)} and ${OffsetDateTime.parse(dateTimeVariable)} should also work for flow expressions.

Doing this allows the date to be reconstructed by ELs and in Java external task workers. If there’s a more elegant solution, I’m interested in hearing it! Until then, I’ll mark this one as the solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.