AnsweredAssumed Answered

Variables through workflow...

Question asked by mliwski on Nov 22, 2007
Hi, I want to solve the "problem" about there is only one writeable variable per task, so I think to use Array variable to solve this but doesn't work….


<task-node name="aTask">
         <task swimlane="asignee" name="wf:aTask"></task>
      <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript" name="testArray">
               <script>
               <variable name="bpm_package" access="read"/>
               <variable name="testArray" access="write" mapped-name="testArray"/>
               <expression>
                  document   = bpm_package.children[0];

                  testArray    = new Array(2);
                  testArray[0]= document.properties.name;
                  testArray[1]= "String";
               </expression>
              </script>
           </action>
       </event>
   <transition name="ToOtherTask" to="otherTask"></transition>
</task-node>

<task-node name="otherTask">
         <task swimlane="asignee" name="wf:anOtherTask"></task>
      <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript" name="secondTestArray">
               <script>
               <variable name="bpm_package" access="read"/>
               <variable name="testArray" access="read" mapped-name="testArray"/>
               <expression>
                  document   = bpm_package.children[0];
                  
                  document.properties.name = testArray[0] + testArray[1];
                  document.save();
               </expression>
              </script>
           </action>
       </event>
   <transition name="ToThirdTask" to="thirdTask"></transition>
</task-node>

I also tried without the mapped-name…

I hope that anyone can help me ….

EDITED….

Actually im trying now with d:noderef (try to pass a folder as global variable) and happens the same problem (no with String, dates, etc…)

The type of each task variable is defined by the Task description i.e. the data type of the respective property, or in the case of associations, a collection. Many Alfresco data types map conveniently to jBPM data types e.g. d:text to string, d:boolean to boolean. However, there is special support for d:noderef and associations that require further attention.
Extracted from http://wiki.alfresco.com/wiki/WorkflowAdministration#Process_Data

Outcomes