Hi Thorben,
Not being a Java programmer, I am using Camunda purely via the REST API. A unittest on github is beyond my capabilities. I will try to make my problem more explicit:
The online documentation says the following about defining a timer based on process variable:
Expressions
You can use expressions for the timer event definitions. By doing so you can influence the timer definition based on process variables. The process variables must contain the ISO 8601 (or cron for cycle type) string for the appropriate timer type.
This means, however, that the timer value must be fully pre-calculated by some previous tasks before the timer activity is reached.
Suppose now that in one user task the end user sets a doctor appointment time, which is saved in a process variable named appointmentTime
. Now we would like the user to be reminded one day before the appointed time. We could calculate an additional process variable named timeToRemind
when user submits the task. But I thought it should be easier by doing some time arithmetic in the timer definition itself.
In the Expression Language
section of the online documentation something very close is mentioned for use in the definition of task due dates:
<userTask id="theTask" name="Important task" camunda:dueDate="${dateTime().plusDays(3).toDate()}"/>
So I thought whether it is possible to define the reminder timer likewise using Expression Language as:
<timerEventDefinition>
<timeDate>${dateTime(appointmentTime).minusDays(1).toDate()}</timeDate>
</timerEventDefinition>
But as it turns out, the internal function dateTime
only returns the DateTime
object of the current date. It can not convert existing process variable to Joda-Time DateTime
object.
So actually my question boils down to:
Is it possible to perform datetime arithmetic, using the Expression Language, on a date stored in a process variable, for use in the timer definition?
Any suggestion is welcome.
Regards
Hong Yuan