<?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 make variables persistent? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-make-variables-persistent/m-p/10587#M4721</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have defined an Activiti process and I can not force variables to be persistent across whole process (they just "evaporate")!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I have "&lt;STRONG&gt;&lt;EM&gt;san:value&lt;/EM&gt;&lt;/STRONG&gt;" property defined in &lt;EM&gt;mainUserTask&lt;/EM&gt; type in &lt;EM&gt;workflowModel.xml&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Every other task is a child of this &lt;EM&gt;mainUserTask&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Now, in the Alfresco Share, in the user task I enter the value of "&lt;STRONG&gt;&lt;EM&gt;san:value&lt;/EM&gt;&lt;/STRONG&gt;" and click "Task done".&lt;/P&gt;&lt;P&gt;In the next task, I want to have the same input field with the value I entered earlier. But the value is empty! Why?&lt;/P&gt;&lt;P&gt;I managed to solve the problem by declaring a TaskListener which gets variable from task and saves it to the execution.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.&lt;BR /&gt;  &amp;lt;activiti:field name="script"&amp;gt;&lt;BR /&gt;    &amp;lt;activiti:string&amp;gt;&amp;lt;![CDATA[execution.setVariable('san_value', task.getVariable('san_value'));]]&amp;gt;&amp;lt;/activiti:string&amp;gt;&lt;BR /&gt;  &amp;lt;/activiti:field&amp;gt;&lt;BR /&gt;&amp;lt;/activiti:taskListener&amp;gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But do I really have to do it in every single task with every single variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next problem is, that&lt;STRONG&gt; in the "Workflow Detalis" view, those variables are empty...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Anyone has an idea how this can be fixed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried calling &lt;EM&gt;Java&lt;/EM&gt; class in the taskListener and instantiate variables there but with the same result.&lt;/P&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;String myprocessinstanceid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; delegateTask&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;ProcessEngine processEngine &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ProcessEngines&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getDefaultProcessEngine&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;RuntimeService myruntimeservice &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; processEngine&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getRuntimeService&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;myruntimeservice&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;setVariable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myprocessinstanceid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"san_value"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; delegateTask&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVariable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"san_value"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 03 Aug 2019 15:33:31 GMT</pubDate>
    <dc:creator>upforsin</dc:creator>
    <dc:date>2019-08-03T15:33:31Z</dc:date>
    <item>
      <title>How to make variables persistent?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-make-variables-persistent/m-p/10587#M4721</link>
      <description>Hello,I have defined an Activiti process and I can not force variables to be persistent across whole process (they just "evaporate")!Let's say I have "san:value" property defined in mainUserTask type in workflowModel.xml.Every other task is a child of this mainUserTask.Now, in the Alfresco Share, in</description>
      <pubDate>Sat, 03 Aug 2019 15:33:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-make-variables-persistent/m-p/10587#M4721</guid>
      <dc:creator>upforsin</dc:creator>
      <dc:date>2019-08-03T15:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to make variables persistent?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-make-variables-persistent/m-p/10588#M4722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, i believe there is &lt;STRONG&gt;NO way&lt;/STRONG&gt; to achieve that. Workflow History view displays only the history and tt was designed not to be edited...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Aug 2019 15:38:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-make-variables-persistent/m-p/10588#M4722</guid>
      <dc:creator>upforsin</dc:creator>
      <dc:date>2019-08-04T15:38:02Z</dc:date>
    </item>
  </channel>
</rss>

