AnsweredAssumed Answered

how to create global process variables

Question asked by boneill on Jun 9, 2009
Latest reply on Sep 11, 2009 by kbootz
hi All,

I have been pulling my hair out for two days on this so would really appreciate any pointers:

I have a task that sets a variable called signOff to either true or false depending on whether I have collected a value from a user.  I have debugged this and this part works:

<task-node name="validsignoff" >
        <task name="validwf:validSignOffTask" swimlane="initiator">    
        <transition name="approve" to="signoffreceived" >
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                      <variable name="validwf_validid" access="read"/>
                      <variable name="signOff" access="write" />
                          logger.log("Valid ID = " + validwf_validid);
                          signOff = false;
                          if (validwf_validid != null &amp;&amp; validwf_validid.length != 0)
                             signOff = true;
                                                     logger.log("ValidSignOFF - signOff = " + signOff);
       <transition to="rejected" name="reject"></transition>

I then read this variable value in a decision node to determine which path to follow, onto end if user has entered a value, or back to the originating node if the user has not set a value.

<decision name="signoffreceived">         
      <transition to="validsignoff" name="incompletesignoff">
         <condition>#{signOff == false}</condition>
      <transition to="endreview">
         <condition>#{signOff == true}</condition>

However it does not work as signOff comes up as undefined. 
So how do I set signOff to be a gloabal variable and how do I evaluate it in the transition code.

Any help really, really appreciated.