<?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: Null result from taskService.createTaskQuery().processInstanceId().singleResult() in a script task in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237105#M190235</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also had this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue here is that you are creating user tasks in a SubProcess but quering for tasks using the processInstanceId of the parent process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fix this, first find the sub-process instance where the Tasks were created:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery()&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;.superProcessInstanceId( theSCMProcess.getInstanceId() ).singleResult();&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then perform the Task search using the id of the sub-process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="background: none #f6f6f6; border-left: 2px solid #cccccc; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Task task1 = taskService.createTaskQuery()&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;.processInstanceId( subProcessInstance.getInstanceId() ).singleResult();&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jul 2018 15:04:05 GMT</pubDate>
    <dc:creator>ghamer</dc:creator>
    <dc:date>2018-07-13T15:04:05Z</dc:date>
    <item>
      <title>Null result from taskService.createTaskQuery().processInstanceId().singleResult() in a script task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237101#M190231</link>
      <description>I'm having a problem with taskService.createTaskQuery().processInstanceId().singleResult() when executed in a script task.I have tried the same code in a unit test and it works correctly. To me it looks like the query is not selecting data in the same session.Like data that is not yet committed is n</description>
      <pubDate>Fri, 30 Sep 2016 11:06:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237101#M190231</guid>
      <dc:creator>maudrid</dc:creator>
      <dc:date>2016-09-30T11:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Null result from taskService.createTaskQuery().processInstanceId().singleResult() in a script task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237102#M190232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In case there is confusion about why the log says 'SCMBulkUpload.js', it should say 'myTestLog'. I renamed it when preparing this post but did not run it again to get new log output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also I forgot to mention that I am using Activiti 6 beta 2&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2016 11:23:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237102#M190232</guid>
      <dc:creator>maudrid</dc:creator>
      <dc:date>2016-09-30T11:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Null result from taskService.createTaskQuery().processInstanceId().singleResult() in a script task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237103#M190233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;*bump*&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:38:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237103#M190233</guid>
      <dc:creator>maudrid</dc:creator>
      <dc:date>2016-10-12T13:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Null result from taskService.createTaskQuery().processInstanceId().singleResult() in a script task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237104#M190234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Still nothing?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 14:11:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237104#M190234</guid>
      <dc:creator>maudrid</dc:creator>
      <dc:date>2016-11-23T14:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Null result from taskService.createTaskQuery().processInstanceId().singleResult() in a script task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237105#M190235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also had this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue here is that you are creating user tasks in a SubProcess but quering for tasks using the processInstanceId of the parent process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fix this, first find the sub-process instance where the Tasks were created:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery()&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;.superProcessInstanceId( theSCMProcess.getInstanceId() ).singleResult();&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then perform the Task search using the id of the sub-process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="background: none #f6f6f6; border-left: 2px solid #cccccc; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Task task1 = taskService.createTaskQuery()&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;.processInstanceId( subProcessInstance.getInstanceId() ).singleResult();&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:04:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/null-result-from-taskservice-createtaskquery-processinstanceid/m-p/237105#M190235</guid>
      <dc:creator>ghamer</dc:creator>
      <dc:date>2018-07-13T15:04:05Z</dc:date>
    </item>
  </channel>
</rss>

