AnsweredAssumed Answered

Time Duration support in User Task Due Date

Question asked by balsarori on Jun 10, 2013
Latest reply on Jun 12, 2013 by frederikheremans1
Hi,

Task due dates are commonly used as relative dates (relative to task creation date) and if I am not mistaken, the only way to set task relative due date is by using an external bean. I suggest to add support for ISO8601 Durations format in user tasks due date similar to time duration in Timer Event Definitions.

This will make it easier to set relative due dates in tasks without the need of using an external bean. For example, a user task with one month relative (relative to task creation date) due date can be set as follows:


<userTask id="theTask" name="Important task" activiti:dueDate="P1M"/>

I tried to implement this by editing resolveDuedate() method of org.activiti.engine.impl.calendar.DueDateBusinessCalendar as follows:

[java]
    try {
       
       // check if duration was specified
       if(duedate.startsWith("P")){
          return DateTime.now().plus(Period.parse(duedate)).toDate();
       }
          
      return DateTime.parse(duedate).toDate();

[/java]

It seems to work properly (although I can not say that I tested all cases).

Another way this can be supported is by using a special attribute in user task such as the following:


<userTask id="theTask" name="Important task" activiti:timeDuration="P1M"/>


I think that such support would be useful. What do you guys think? Will such support be useful and whats the best way to implement it?

Outcomes