<?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 Re: link newTask to process instance in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5063#M2427</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here it is a unit test of my issue, maybe it can be helpful to solve my problem. &lt;B&gt;Niklas Menke&lt;/B&gt;‌&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ajeje93/activiti-junit-newtask" title="https://github.com/ajeje93/activiti-junit-newtask" rel="nofollow noopener noreferrer"&gt;GitHub - ajeje93/activiti-junit-newtask: JUnit for testing the creation of a newTask with linking to a process instance&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Feb 2017 19:54:41 GMT</pubDate>
    <dc:creator>ajeje93</dc:creator>
    <dc:date>2017-02-08T19:54:41Z</dc:date>
    <item>
      <title>link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5058#M2422</link>
      <description>I'm trying to modify Activiti 5.22 source code in order to link a task, created with the method newTask from the class TaskService, to a process instance, so that when I'm calling historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).finished().orderByHistor</description>
      <pubDate>Wed, 08 Feb 2017 02:48:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5058#M2422</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-08T02:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5059#M2423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ludovico Serrani,&lt;/P&gt;&lt;P&gt;i don't understand why you modify the NewTaskCmd. Why don't you just cast the new created Task to TaskEntityImpl and set your properties&amp;nbsp;there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;TaskEntityImpl task = (TaskEntityImpl) taskService.newTask();&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 07:33:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5059#M2423</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-02-08T07:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5060#M2424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because I didn't think about doing that. &lt;IMG src="https://connect.hyland.com/legacyfs/online/alfresco/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;Now I did as you say so:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;TaskEntity newTask = (TaskEntity) taskService.newTask("newTask");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;newTask.setProcessDefinitionId(processDefinition.getId());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;newTask.setProcessInstanceId(procId);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;newTask.setExecutionId(procId);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;newTask.setName("New Task");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;newTask.setDescription("This is a new task");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;taskService.saveTask(newTask);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;but I always get the error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ERROR org.activiti.engine.impl.interceptor.CommandContext&amp;nbsp; - Error while closing command context&lt;BR /&gt;org.activiti.engine.ActivitiException: UserTask should not be signalled before complete&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Do you know how to avoid that error?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Thank you again for solving part of my problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Ludovico&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 09:42:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5060#M2424</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-08T09:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5061#M2425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have also a problem with creating a task. When&amp;nbsp;i save a task with an id i have chosen i get a NPE&amp;nbsp;in the SaveTaskCmd. Maybe you should try it without setting explicitly the id and activity will create a number for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just use:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newTask.setTaskDefinitionKey("newTask");&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This will set the activityId like you would set in the bpmn file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 10:57:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5061#M2425</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-02-08T10:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5062#M2426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you again for helping me. This solved the activiyId problem but I always get that error on signal when I'm trying to complete a task, when I set executionId. I get it no matter which task I call. However if I do not set it, I really don't know how to make the history service understand that the new task is related to the process instance.&lt;/P&gt;&lt;P&gt;Ludovico&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:45:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5062#M2426</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-08T13:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5063#M2427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here it is a unit test of my issue, maybe it can be helpful to solve my problem. &lt;B&gt;Niklas Menke&lt;/B&gt;‌&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ajeje93/activiti-junit-newtask" title="https://github.com/ajeje93/activiti-junit-newtask" rel="nofollow noopener noreferrer"&gt;GitHub - ajeje93/activiti-junit-newtask: JUnit for testing the creation of a newTask with linking to a process instance&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 19:54:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5063#M2427</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-08T19:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5064#M2428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, there is a problem. While the completion of the newly created task the execution is queried. But this execution does not know about the task. So the error is raised. It seems like you have to create a new execution for this task. But that could be pretty hard.&lt;/P&gt;&lt;P&gt;There should be another workaround. Can you describe your use case a bit?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 07:25:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5064#M2428</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-02-09T07:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5065#M2429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There nothing much to say, unfortunately. The user should be able to create and execute new tasks during process execution; these newly created tasks should be shown in history service when I'm querying it on a particular process instance.&lt;/P&gt;&lt;P&gt;This is why I'm trying to set executionId to the same value of processInstanceId.&lt;/P&gt;&lt;P&gt;Will creating a new execution do a link between the task and the process instance?&lt;/P&gt;&lt;P&gt;Could adding those tasks to the process definition dynamically change something? Is it possible?&lt;/P&gt;&lt;P&gt;Is there some way in which, maybe, I can modify the sources to make the execution know about the task or I can create a new method that calls a command doing such a thing?&lt;/P&gt;&lt;P&gt;Thank you again for your time.&lt;/P&gt;&lt;P&gt;Ludovico&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 09:26:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5065#M2429</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-09T09:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5066#M2430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't tried to create a new execution for now. So i cannot answer your question.&lt;/P&gt;&lt;P&gt;Yeah there is an option to change the process definition dynamically. The two following links can help for this approach.&lt;/P&gt;&lt;P&gt;&lt;A href="https://gromar01.wordpress.com/2016/06/16/design-by-doing-with-activiti6/" rel="nofollow noopener noreferrer"&gt;Design by Doing 1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gromar01.wordpress.com/2016/10/27/design-by-doing-2-with-flowable/" rel="nofollow noopener noreferrer"&gt;Design by Doing 2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But i have another question. Would it be enough to create subtasks? These can be queried in the history.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 09:34:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5066#M2430</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-02-09T09:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5067#M2431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Design by doing could be a solution.&lt;/P&gt;&lt;P&gt;If I would like to query subtasks should I do an HistoricTaskInstanceQuery on finished tasks? If so, I don't think that this is enough because I would also like to track the process instance to which they're related.&lt;/P&gt;&lt;P&gt;I'll let you know for desing by doing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 10:50:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5067#M2431</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-09T10:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: link newTask to process instance</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5068#M2432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Design by doing it's the correct solution.&lt;/P&gt;&lt;P&gt;I'm sorry if I didn't let you know if it worked, but I never had the chance to try it until now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2017 10:29:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/link-newtask-to-process-instance/m-p/5068#M2432</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2017-02-21T10:29:36Z</dc:date>
    </item>
  </channel>
</rss>

