5 Replies Latest reply on Dec 18, 2009 12:18 PM by kukeltje

    jbpm4: How do I use variables in timer definitions

      The timer implementation appears to have changed a bit in jbpm4 from jbpm 3. I am trying to upgrade from 3 to 4 and in 3 I defined a timer this way:

       

       

      <state name="Idle">

       

      <timer duedate="#{DaySwapEod}" name="daySwapEodTimer"

       

      transition="DoDayEnd">

       

      </timer>

       

      <transition to="WaitingForRunningChildBPsToEnd" name="DoDayEnd"></transition>

       

      </state>

       

      Here #{DaySwapEod} was cerated as a variable of the type Date on the process instance. Before entering the state Idle, the variable would be set and the timer would then fire at this date and time.

       

      In jbpm4 the duedate attribute of the timer is different and if I want to specify an absolute time, I have to use the attribute duedatetime and the argument is ofthe type String. I tried to do it this way:

       

       

      <state g="65,195,92,52" name="Idle">

       

      <transition g="9,-16" name="DoDayEnd" to="WaitingForRunningChildBPsToEnd">

       

      <timer duedatetime="#{DaySwapEod}" />

       

      </transition>

       

      </state>

       

      But the error I get it

        error: couldn't parse duedatetime #{DaySwapEod} : java.text.ParseException: Unparseable date: "#{DaySwapEod}"

      It appears that #{DaySwapEod} is not recognized as a variable, like it used to be in jbpm3. I need help to understand how I can specify the duedatetime as a variable to be set before I enter the state that has the timer.