<?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 Problem with setting process variable on a usertask listener in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114438#M80634</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a workflow whose first task has a listener attached to it. This listener performs some processing and then attempts to store the result in the activiti process variable. This doesn't work for me because I always get the exception&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SEVERE: Error while closing command context&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: execution 5 doesn't exist&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:529)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Whilst debugging through the code I see that the process is started using processInstanceId = workflowManager.startWorkflow(processDefinitionKey, processBean); and the task listener is invoked before the startWorkflow method returns. I can only assume that the execution hasn't fully been setup by the time the user task listener is invoked and therefore the execution ID it is trying to use to save the process variable doesn't completely exist.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code works fine if the same listener, configured in the same way is attached to a second task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas? Does this sound like a defect with Activiti or am I doing something wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The events that I tried to attach the listener to are create and also assignment. Neither work for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Sep 2012 10:47:00 GMT</pubDate>
    <dc:creator>marcthomas2012</dc:creator>
    <dc:date>2012-09-13T10:47:00Z</dc:date>
    <item>
      <title>Problem with setting process variable on a usertask listener</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114438#M80634</link>
      <description>Hi,I have a workflow whose first task has a listener attached to it. This listener performs some processing and then attempts to store the result in the activiti process variable. This doesn't work for me because I always get the exceptionSEVERE: Error while closing command contextorg.activiti.engin</description>
      <pubDate>Thu, 13 Sep 2012 10:47:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114438#M80634</guid>
      <dc:creator>marcthomas2012</dc:creator>
      <dc:date>2012-09-13T10:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with setting process variable on a usertask listener</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114439#M80635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you have the (minimalized) code of your listener?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Sep 2012 08:56:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114439#M80635</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2012-09-15T08:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with setting process variable on a usertask listener</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114440#M80636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have created a unit test in an eclipse project to demonstrate the issue and shared it via dropbox as I couldn't upload it to the forum. (&lt;/SPAN&gt;&lt;A href="https://www.dropbox.com/s/c144xoxd637oerl/Development.zip" rel="nofollow noopener noreferrer"&gt;https://www.dropbox.com/s/c144xoxd637oerl/Development.zip&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a method call verifyTestVariableValueCorrect which I am expecting to pass for both calls made to it. However, an exception is thrown in the listener which is attached to both tasks in the process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd really appreciate any help that you can provide.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 09:54:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114440#M80636</guid>
      <dc:creator>marcthomas2012</dc:creator>
      <dc:date>2012-09-17T09:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with setting process variable on a usertask listener</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114441#M80637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Don't use the runtime service from inside listener, rather use the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;delegateTask.getExecution().setVariable("", "");&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 15:19:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114441#M80637</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-09-17T15:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with setting process variable on a usertask listener</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114442#M80638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Fantastic, thank you for the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 16:18:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-setting-process-variable-on-a-usertask-listener/m-p/114442#M80638</guid>
      <dc:creator>marcthomas2012</dc:creator>
      <dc:date>2012-09-17T16:18:54Z</dc:date>
    </item>
  </channel>
</rss>

