Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-5732

conditional events do not work as expected when using $processInstance : org.kie.api.runtime.process.WorkflowProcessInstance() construct


    • Docs QE Status:
    • QE Status:


      In conditional event we need to access process variables to compare with facts values.

      In conditional event script we have:

      // get hold of a reference to the process instance this conditional event is in
      $processInstance : org.kie.api.runtime.process.WorkflowProcessInstance() 
      // get a process variable to use in conditional event script
      $procVar : String() from(String)$processInstance.getVariable("procVar");

      We found that sometimes $processInstance references the correct process but in some instances references other process so $procVar gets wrong value.

      The documentation I found about this feature in conditional event is here: https://docs.jboss.org/jbpm/release/6.5.0.Final/jbpm-docs/html/ch06.html#d0e4474

      Rule constraints do not have direct access to variables defined inside the process. It is however possible to refer to the current process instance inside a rule constraint, by adding the process instance to the Working Memory and matching for the process instance in your rule constraint. We have added special logic to make sure that a variable processInstance of type WorkflowProcessInstance will only match to the current process instance and not to other process instances in the Working Memory. Note that you are however responsible yourself to insert the process instance into the session and, possibly, to update it, for example, using Java code or an on-entry or on-exit or explicit action in your process. The following example of a rule constraint will search for a person with the same name as the value stored in the variable "name" of the process:

      processInstance : WorkflowProcessInstance()
      Person( name == ( processInstance.getVariable("name") ) )

      1. add more constraints here ...

        Gliffy Diagrams


            Issue Links



                • Assignee:
                  swiderski.maciej Maciej Swiderski
                  danutc Dan Cimpoesu
                • Votes:
                  0 Vote for this issue
                  2 Start watching this issue


                  • Created: