2 Replies Latest reply on Oct 28, 2012 10:07 PM by rickylkl

    anyone guide me how to access processinstance in split constraints?

    rickylkl

      Dear all,

       

      rule "Example validation rule"
          ruleflow-group "validate"

          when
              processInstance : WorkflowProcessInstance()
          then
              processInstance.setVariable("isValid", new Boolean(false));
      end

       

      that's wt i know to access processInstance in rule flow , drl file .

      But how do i get the isValid variable in SPLIT GATEWAY CONSTRAINTS ??

       

       

      THanks & Regards

        • 1. Re: anyone guide me how to access processinstance in split constraints?
          salaboy21

          you should do something like the following if you are writing a Java expression.

          return kcontext.getKnowledgeRuntime().getProcessInstance(<id>).getVariable("isValid");

           

           

           

          If you wanna write a rule expression it will be in the same way as you showed before:

           

          WorkflowProcessInstance(variables["isValid"] == <true|false>)

           

          Cheers

          • 2. Re: anyone guide me how to access processinstance in split constraints?
            rickylkl

            Hi Salatino ,

             

                 Thanks for the reply, may i ask a bit more?

                

                 1.     How can i know the processInstance id in split constratins ?

             

                 2.     By the way, when i try this - WorkflowProcessInstance(variables["isValid"] == true), it shows below exception, any idea ?

                        

                         unable to resolve method using strict-mode: org.drools.runtime.process.WorkflowProcessInstance.variables

                         [Near : {... variables["isValid"] == true ....}]

             

                

                 Thanks & Regards

             

            Ricky