<?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 execution.setVariable() doesnt set on Parent process in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/execution-setvariable-doesnt-set-on-parent-process/m-p/32438#M16843</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have two processes, one of which is being called as a subprocess from the other.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When i call setVariable on the execution from within a java task delegate of the sub-process, It is only setting the variable locally, and not on the parent processes variables map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This means that when I try to set a variable to signal success or failure of the sub-process to the calling process, the calling process is not seeing the variable and so is falling over with an exception.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to get the variable to propogate up to the parent process, I am having to cast the execution parameter from DelegateExecution to ExecutionEntity, call getSuperExecution() and then set the variables on that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the below source code (VariableScopeImpl.java), it looks like setVariable should set the variable on the parent variable scope if it doesnt exist as a local variable. When I debug my code though, parentVariableScope is null, because parent is null on the ExecutionEntity instance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is… is this the expected behaviour? or should a call to setVariable on a sub-process execution, propogate the variable up to the calling process?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, is there some element or attribute required in the callActivity xml to achieve this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;variableScopeImpl&lt;BR /&gt;public void setVariable(String variableName, Object value) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (hasVariableLocal(variableName)) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setVariableLocal(variableName, value);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VariableScope parentVariableScope = getParentVariableScope();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (parentVariableScope!=null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parentVariableScope.setVariable(variableName, value);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; createVariableLocal(variableName, value);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Jan 2011 16:04:10 GMT</pubDate>
    <dc:creator>awelsh</dc:creator>
    <dc:date>2011-01-27T16:04:10Z</dc:date>
    <item>
      <title>execution.setVariable() doesnt set on Parent process</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/execution-setvariable-doesnt-set-on-parent-process/m-p/32438#M16843</link>
      <description>I have two processes, one of which is being called as a subprocess from the other.When i call setVariable on the execution from within a java task delegate of the sub-process, It is only setting the variable locally, and not on the parent processes variables map.This means that when I try to set a v</description>
      <pubDate>Thu, 27 Jan 2011 16:04:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/execution-setvariable-doesnt-set-on-parent-process/m-p/32438#M16843</guid>
      <dc:creator>awelsh</dc:creator>
      <dc:date>2011-01-27T16:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: execution.setVariable() doesnt set on Parent process</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/execution-setvariable-doesnt-set-on-parent-process/m-p/32439#M16844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The 5.2 release will contain a way of mapping process variables to parent processes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, your workaround is indeed the way to go.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jan 2011 11:14:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/execution-setvariable-doesnt-set-on-parent-process/m-p/32439#M16844</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2011-01-28T11:14:23Z</dc:date>
    </item>
  </channel>
</rss>

