3 Replies Latest reply on Jan 29, 2008 6:12 AM by Ronald van Kuijk

    how to define global variables for process in xml

    Vitaly Xaoc Newbie

      Hi!
      How to add variables in process-definition.xml to whole process (to make it as global variable which will be visible in any node)?

        • 1. Re: how to define global variables for process in xml
          Ronald van Kuijk Master

          They are by default.... (and please do not cross-post, even if partly identical.... this forum is the correct one)

          • 2. Re: how to define global variables for process in xml
            Vitaly Xaoc Newbie

            Ok! But I've posted here because you said that those forum is wrong! Did I make something wrong?

            I have one more question!
            Variables that are created in expression language in xml is accessible from processInstance.getContextInstance().getVariable("globalStatus")?
            Like here:

            <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="test simple">
             <event type="process-start">
             <action name="action1">
             <script>
             <variable name='globalStatus' access='write' mapped-name='globalStatus'/>
             </script>
             </action>
             </event>
            
             <start-state name="start">
             <transition name="" to="node1"></transition>
             </start-state>
            
             <end-state name="end1"></end-state>
            
             <node name="node1">
             <event type="node-enter">
             <script>
             <expression>
             globalStatus='New';
             System.out.println("this script is entering node"+node+" "+globalStatus);
             </expression>
             </script>
             </event>
             <transition name="" to="end1"></transition>
             </node>
            </process-definition>

            Or is there other way?

            • 3. Re: how to define global variables for process in xml
              Ronald van Kuijk Master

              ahh... sorry, I thought they were posted at the same time... my bad...

              I'll try your example and see what happens... one other option is something like:

               <action name="action1">
               <varname1>value</varname1>
               </action>
              
              


              Where action can process these and set them.... see normal action examples for this