<?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: Setting process variable at run time in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218979#M172109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Barrez,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PFA the test code and the bpmn xml files for your review&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jul 2016 13:02:43 GMT</pubDate>
    <dc:creator>niyas_m</dc:creator>
    <dc:date>2016-07-27T13:02:43Z</dc:date>
    <item>
      <title>Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218973#M172103</link>
      <description>Hi,&amp;nbsp; I am new&amp;nbsp; to Activiti . I would like to know how to set process variables to an existing process instance ( already instantiated ) at run time. The use case to provide condition value for an exclusive gateway following an user task completion . I tried the following methods . 1. runtimeService.</description>
      <pubDate>Tue, 26 Jul 2016 12:42:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218973#M172103</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-26T12:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218974#M172104</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;If you use service task you can set the process variables there. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public void execute(DelegateExecution execution) throws Exception {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;execution.setVariable("&amp;lt;VariableName&amp;gt;",&amp;lt;VariableValue&amp;gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can set them similarly in script task also. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:40:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218974#M172104</guid>
      <dc:creator>hari</dc:creator>
      <dc:date>2016-07-27T11:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218975#M172105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I also think setting the variables map while completing a task should also work. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:42:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218975#M172105</guid>
      <dc:creator>hari</dc:creator>
      <dc:date>2016-07-27T11:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218976#M172106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Hari,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Thanks for the idea. Will try it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:47:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218976#M172106</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-27T11:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218977#M172107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hari,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I tried this way as option # 2 mentioned in my original post. But unfortunately its not working . Values supplied as part of task completion is not carried over to the exclusive gateway for its conditional navigation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 11:49:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218977#M172107</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-27T11:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218978#M172108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt; Both are not working .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do yo mean? Those two option do that, they set the variables.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How did you verify that the variables were not set?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A small bit of test code would to understand what's happening here.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 12:10:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218978#M172108</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2016-07-27T12:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218979#M172109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Barrez,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PFA the test code and the bpmn xml files for your review&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2016 13:02:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218979#M172109</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-27T13:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218980#M172110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Barrez,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The same process and test code is working when i use "sub process" instead of "call activity" . But ideally we will need to separate the business processes into different bpmn files . Please advise why the stuff that works with sub process is not working with call activity. Variable scope constraints ?.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any solution to make it work with call activity ? . &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2016 06:00:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218980#M172110</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-28T06:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218981#M172111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Haven't looked at the xml but,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; The same process and test code is working when i use "sub process" instead of "call activity" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Call activity _do not_ inherit variables like subprocesses.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You need to explicitly map variables in and out for call activities (checks the docs on call activity)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2016 09:48:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218981#M172111</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2016-07-28T09:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218982#M172112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Barrez ,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Thanks for the update.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Yes , i have mapped the variables in call activity. ( sourceExpression="${action}" target="action" ) .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Issue i am facing using call activity is , the value for the variable is reaching the X-OR gateway only when i declare them as part of process instance creation. (setting through run time service or task completion is not working) . &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; But , i could do it through a service / script task .I am still wondering why the below methods are not working with call activity as it would have made the execution simple without service / script tasks elements &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; 1. runtimeService.setVariable(processInstance.getId(),"variable","value");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. taskService.complete(tasks.get(0).getId(), vars);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2016 11:01:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218982#M172112</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-28T11:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218983#M172113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay, I looked at your test. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason is because a call activity _is_ actually a real process instance (it will show up in queries as such).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hence, when you set your variable&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; runtimeService.setVariable(pi.getId(), "action", "task2");&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You're setting it on the main process, not on the new started process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Add the following line and it will work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ProcessInstance newProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;runtimeService.setVariable(newProcessInstance.getId(), "action", "task2");&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2016 08:28:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218983#M172113</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2016-07-29T08:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Setting process variable at run time</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218984#M172114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Barrez,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Thanks for the solution. Will try as suggested&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Niyas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jul 2016 05:56:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-process-variable-at-run-time/m-p/218984#M172114</guid>
      <dc:creator>niyas_m</dc:creator>
      <dc:date>2016-07-31T05:56:16Z</dc:date>
    </item>
  </channel>
</rss>

