cancel
Showing results for 
Search instead for 
Did you mean: 

add comment to the task from the process itself

cutout33
Champ in-the-making
Champ in-the-making
is it possible to add comment to the task from the design itself? i mean in the process design. bcause am creating a ticketing system and people should see the full history of the tickt and not only the cureent status/task.

Also I have another question, where can I see/list the completed tasks? I can not find a task once it is marked completed, if it is not too much show me how in both explorer and using code.
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
is it possible to add comment to the task from the design itself? i mean in the process design. bcause am creating a ticketing system and people should see the full history of the tickt and not only the cureent status/task.

What do you mean with comment? Do you mean comment as in taskService.addComment(…) ?

If so, the only way to do that is to add something like a task listener to your task that does that behind the scenes.

Also I have another question, where can I see/list the completed tasks? I can not find a task once it is marked completed, if it is not too much show me how in both explorer and using code.

Use the historyService. Once a task is completed, the task is moved to the historical tables.

cutout33
Champ in-the-making
Champ in-the-making
What do you mean with comment? Do you mean comment as in taskService.addComment(…) ?

If so, the only way to do that is to add something like a task listener to your task that does that behind the scenes.

Yes this is exactly what I mean, does the listner have access to activiti context? i.e from where can I get the taskService in order to add the comment, is it accessible from the task itself or do I have to build a ProcessEngine and get the service from it!


Use the historyService. Once a task is completed, the task is moved to the historical tables.

Thanks for the clarification

cutout33
Champ in-the-making
Champ in-the-making
OK I figuered out how to add comment using listener, but sadly this did not solve my problem. so let me describe the issue am facing, am trying to create a simple tickting scenario, it works fine but the users can not see the history of this ticket and the back and forth of the support and customer comments. how can I make this visible? because when adding a comment on a task it is only shown in the task but not in other tasks within the process 😕
please help understand how to achive this.

Thanks in advance.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
By writing your own ui and using the java api to retrieve all other comments?

cutout33
Champ in-the-making
Champ in-the-making
By writing your own ui and using the java api to retrieve all other comments?

Yes I already have my own UI, but I am unable to figure out how to get all the comments for a process not only one task in it, so this is my question…

trademak
Star Contributor
Star Contributor
Hi,

You can use the TaskService getProcessInstanceComments or getTaskComments methods.
The process instance comments method only returns the comments that are explicitly added to that process instance.

Best regards,

cutout33
Champ in-the-making
Champ in-the-making
You can use the TaskService getProcessInstanceComments or getTaskComments methods.
The process instance comments method only returns the comments that are explicitly added to that process instance.

we are making a progress Smiley Happy but still this way am unable to display the events for all the tasks in the process 😕 how can I get all the events of all the tasks under a process  :roll:

thanks a lot for the help

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
which ones are you missing?

cutout33
Champ in-the-making
Champ in-the-making
I think I figured it out:


List<org.activiti.engine.task.Task> activitiTasks = taskService.createTaskQuery().processInstanceId(processInstanceId).list();
List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).list();
then I loop on both lists to get events and finally sort my list by date

taskService.getTaskEvents(task.getTaskId());