JBoss Community

Re: Accessing process variables in rule-task

created by Hunor-Attila Kerekes in jBPM - View the full discussion

Hello Esteban,

 

I have the same problem what leon has. I have added to my fisrt human task at the entry action the kcontext.getKnowledgeRuntime().insert(kcontext.getProcessInstance()); script. My rule currently look like this :

import com.sample.User;

import org.drools.runtime.process.WorkflowProcessInstance

 

 

 

rule "AgeCheck3"

ruleflow-group "AgeCheck"

 

 

    when

        processInstance : WorkflowProcessInstance()

        age: Integer() from (Integer)((WorkflowProcessInstance)processInstance).getVariable("Age");

        eval(age < 18);

    then

        processInstance.setVariable("Name", new String("Denied"));

        System.out.println(age);

        

end

 

 

If I am removing the age declaration with eval(true) the rule is fired and the name is set to Denied. The compiler accept the declaration, no errors during te running phase, but the rule is not fired.

Can you help me plese? I am doing my master thesis and this is also a small part of it.

 

Thank you in advance.

Kind regards, Hunor

Reply to this message by going to Community

Start a new discussion in jBPM at Community