<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to track the user completing the subtask(Check List Task) in the parent task? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19342#M8547</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Task belonging to a process, when this task is claimed I trigger multiple self assigning Tasks by code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if user1 claims the task then a couple of pre-defined subtasks are assigned to the same user, in this case user1. Now this user1 can complete these sub tasks or decide to assign it to someone else who eventually completes it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to track the user completing these subtasks within a &amp;nbsp;process variable in the Parent Task. Or suggest a better way of achieving this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me... Thank you...&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Apr 2017 18:39:30 GMT</pubDate>
    <dc:creator>paiyyavj13</dc:creator>
    <dc:date>2017-04-24T18:39:30Z</dc:date>
    <item>
      <title>How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19342#M8547</link>
      <description>Hi,I have a Task belonging to a process, when this task is claimed I trigger multiple self assigning Tasks by code.&amp;nbsp;For example, if user1 claims the task then a couple of pre-defined subtasks are assigned to the same user, in this case user1. Now this user1 can complete these sub tasks or decide to</description>
      <pubDate>Mon, 24 Apr 2017 18:39:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19342#M8547</guid>
      <dc:creator>paiyyavj13</dc:creator>
      <dc:date>2017-04-24T18:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19343#M8548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paiyyavj13_,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know what version of Activiti you're using, but hopefully it's one of the relatively new versions - you should be able to make use of the &lt;A href="https://www.activiti.org/userguide/#eventDispatcher" rel="nofollow noopener noreferrer"&gt;Event Dispatcher mechanism&lt;/A&gt; that's now standard in Activiti.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you define the event handlers, you can choose whether it should act globally or on an individual process instance and can be mapped to a plethora of standard events (like 'TASK_COMPLETED') - which would allow you to track those completed tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if this is exactly what you were hoping for, but it is a solution &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;-JEarles&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 19:59:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19343#M8548</guid>
      <dc:creator>jearles</dc:creator>
      <dc:date>2017-04-27T19:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19344#M8549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me restate the question.&lt;/P&gt;&lt;P&gt;1. Process A - Task A assigned to User 1&lt;/P&gt;&lt;P&gt;2. Task B created (programmatically - although the mechanism is not relevant) as a sub task of Task A&lt;/P&gt;&lt;P&gt;3. Task B is reassigned to User 2&lt;/P&gt;&lt;P&gt;4. User 2 completes Task B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want the ID of User 2 to be saved in a process variable in Process A for use later.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have your scenario correct:&lt;/P&gt;&lt;P&gt;Add a task listener to the "complete" event of the dynamically created task using something like:ActivitiListener listener&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new ActivitiListener();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listener.setEvent(eventName);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listener.setInstance(myTaskListenerImpl);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyUserTask.getTaskListeners().add(listener);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The Listener class (myTaskListenerImpl) will have a DelegateTask input, this will have a parentTask defined from which you can retrieve the parent task, then the associated process instance. Once you have this, you can create an instance variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this is enough to move you forward.&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Apr 2017 16:13:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19344#M8549</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-04-28T16:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19345#M8550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Greg.... this is exactly what I wanted.... Thank you Jonathan Earles too... the link you sent put me in the right track...&lt;/P&gt;&lt;P&gt;Will try the steps and post back...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Apr 2017 16:52:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19345#M8550</guid>
      <dc:creator>paiyyavj13</dc:creator>
      <dc:date>2017-04-28T16:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19346#M8551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;B&gt;Greg Harley&lt;/B&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the steps mentioned by you but there is a small difference in the way I create my subtasks: they are of Type: "&lt;EM&gt;org.activiti.engine.task.Task&lt;/EM&gt;" and not "&lt;EM&gt;org.activiti.bpmn.model.UserTask&lt;/EM&gt;".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence, I could not add my listener to my subtask(as there is no api to get TaskListeners and set it in&amp;nbsp;&lt;EM&gt;org.activiti.engine.task.Task&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought of changing my subtasks into&amp;nbsp;"&lt;EM&gt;org.activiti.bpmn.model.UserTask&lt;/EM&gt;" Type, but I could not find api to set &lt;EM&gt;tenantId&lt;/EM&gt; and &lt;EM&gt;parentTaskId&lt;/EM&gt; on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you suggest some pointers.... Appreciate your help!&lt;/P&gt;&lt;P&gt;Thank you....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 May 2017 20:04:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19346#M8551</guid>
      <dc:creator>paiyyavj13</dc:creator>
      <dc:date>2017-05-03T20:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19347#M8552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're right. My solution is how you would do igt in a parseHandler (which is where I pulled my code from).&lt;/P&gt;&lt;P&gt;From what I can tell (looking at the API), we can't add listeners dynamically, they have to be added to the process model either when the process is modeled, or inside a parse handler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So....you should still be able to add a TaskListener that is triggered on the "assignment" event.&lt;/P&gt;&lt;P&gt;This listener can still create your sub tasks using code like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #242729; border: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 5px;"&gt;&lt;CODE style="border: 0px; font-size: 13px;"&gt; // save task&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task newTask = taskService.newTask();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newTask.setParentTaskId(parentTask.getId());&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newTask.setName("MySubTask");&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskService.saveTask(newTask);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, you should also be able to add an event listener to the process that is bound to the TASK_COMPLETE event.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The listener would get the execution id from the event and from this you should be able to create a historicTaskInstance query based on the executionId.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Once you have the task, look to see if there is a parent task, if so, set the process variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Something of a long way around, but it should get you there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Be aware, events are processed asynchronously which is why you need to use a history query rather than a runtime query because you cant guarantee order.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 May 2017 21:02:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19347#M8552</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-05-03T21:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to track the user completing the subtask(Check List Task) in the parent task?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19348#M8553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Greg... &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 May 2017 21:19:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-track-the-user-completing-the-subtask-check-list-task-in/m-p/19348#M8553</guid>
      <dc:creator>paiyyavj13</dc:creator>
      <dc:date>2017-05-03T21:19:56Z</dc:date>
    </item>
  </channel>
</rss>

