1 Reply Latest reply on Dec 23, 2013 12:18 PM by Jiri Svitak

    workflow with business rule task

    Kannan g krishnan Newbie

      Hi

       

      i want to create a workflow with business rule task. I am using only drools for the design not using the eclipse. How can i fire the rules and get the global variables in the rule task.

      Some body help me please.

      i am using jbpm 5.4

       

      Thanks in advance.....

      Kannan

        • 1. Re: workflow with business rule task
          Jiri Svitak Novice

          Hi,

          you have to insert facts (objects) into the working memory of the session in order to evaluate them. This can be done in Java code or in a script task. See the example:

          ksession.insert(fact);
          WorkflowProcessInstance wpi = (WorkflowProcessInstance) ksession.startProcess(processId, params);
          ksession.insert(wpi);
          ksession.fireAllRules();
          
          

           

          By inserting the workflow process instance you can reference process variables in the rule definition.

          WorkflowProcessInstanceImpl( $myVariable: variables["myVariable"])
          
          

           

          I am not sure though how to get the global variable, try this:

          kcontext.getKnowledgeRuntime().getGlobal("myGlobalName");
          
          

           

          Hope that helps,

          Jiri