
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2017 06:57 AM
How to create subtask/ checklist task immediately after creating task(parent)? I tried with taskListener but it is not helping as the task creation is not completed and record has not inserted into the database. Please help...
- Labels:
-
Alfresco Process Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2017 01:42 PM
Naveen,
I created a simple TaskListener with the following code:
public void notify(DelegateTask delegateTask) {
getLogger().debug("In TaskListener for task {}", delegateTask.getEventName());
TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
Task newTask = taskService.newTask();
newTask.setParentTaskId(delegateTask.getId());
newTask.setName("MySubTask");
newTask.setAssignee(delegateTask.getAssignee());
newTask.setTenantId(delegateTask.getTenantId());
taskService.saveTask(newTask);
}
I assigned this to the "create" event for a User task and it successfully created a sub task:
Notice the checklist task.....
Let me know if this doesn't satisfy your requirement.
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2017 01:42 PM
Naveen,
I created a simple TaskListener with the following code:
public void notify(DelegateTask delegateTask) {
getLogger().debug("In TaskListener for task {}", delegateTask.getEventName());
TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
Task newTask = taskService.newTask();
newTask.setParentTaskId(delegateTask.getId());
newTask.setName("MySubTask");
newTask.setAssignee(delegateTask.getAssignee());
newTask.setTenantId(delegateTask.getTenantId());
taskService.saveTask(newTask);
}
I assigned this to the "create" event for a User task and it successfully created a sub task:
Notice the checklist task.....
Let me know if this doesn't satisfy your requirement.
Greg

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 01:22 AM
Thanks Greg for the quick reply. Alfresco has provided checklist service (AlfrescoChecklistService.addSubtask) to create checklist task. I want to use this service to create checklist sub-task. Internally this service querying to the DB for parent task which is failing for me. Is there any way to create checklist task immediately after parent task has been created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 12:13 PM
The code I provided successfully creates a subtask, did you try it?
