cancel
Showing results for 
Search instead for 
Did you mean: 

How do I asssign a status to Task for filtering in Tasklist

chimu
Champ in-the-making
Champ in-the-making
While saving a UserTask in the Task table where do we store the current status of the Task. we have the following possible outcomes {Assigned, Completed, Suspended (can be resumed later), Withdrawn, Expired, Errored (while processing), Alerted, Information Requested}
I don't see a status column in the Task table. I can see the history table from where I can fetch all (completed + Assigned) Tasks while Task table will have all Assigned tasks.

My questions are :-

Q1) Do I have to do a union or subtraction between these 2 tables to identify my Tasks status, or I use the "deleteReason" column of Historic task to identify the status.

Q2) Also does a finished task also includes the ones which are Suspended or Expired or Deleted.

Q3) Does Activiti supports all the status which I have listed above ? I know they wont be directly supported, but in case by adding extra predicates or where clause can I extract tasks with those status ??

Q4) Is it acceptable to save TaskId and TaskStatus in our business data table so that in future we can correlate Tasks in Activiti tables (Task table + History table) with actual business data which was approved/rejected etc.. That way we can have user defined status for Tasks but drawback we see it that we will need to join this tables every time we browse through tasks in our Tasklist ??
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
All tasks that are not yet completed, are in the UserTask table. All running and completed tasks are in the history.

1) You can set "task variables" (taskService.setVariableLocal(…)) to set the status and late on, query tasks based on taskVariableEquals("myStatus", "Waiting"). You can also use the deleteReason, in case the status is only applicable for COMPLETED UserTasks
2) If you finish the tasks that are Suspended, Expired or Deleted processes, these will remain in the history-tables.
3) See 1

chimu
Champ in-the-making
Champ in-the-making
1) While using the CDI Business process bean to complete a task how do we assign a delete Reason to the Task, don't see that flag in the CDI Api Java doc.

2) To show All current assigned tasks for a particular user we use taskService.createTaskQuery()
           .taskAssignee(currentUser.getUsername()).list()  , but from our conversation it looks like it will also return expired and suspended and maybe deleted tasks, so to eliminate these records I might need to put additional filters to TaskQuery, so what are the other possible states that could be eliminated from a running task list ?

frederikherema1
Star Contributor
Star Contributor
Completed/deleted tasks will not be shown in the query. For excluding suspended ones:


/**
   * Only selects tasks which are suspended, because its process instance was suspended.
   */
  TaskQuery suspended();
 
  /**
   * Only selects tasks which are active (ie. not suspended)
   */
  TaskQuery active();
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.