Question

I created a "New Rule" in drools guvnor. I want to create a fact with the process instance variables. The ruel I tried:

rule "CreatePersonFact"
    ruleflow-group "CreatePerson"
        dialect "mvel"
        when
            $process: WorkflowProcessInstance()
        then
            Person $person = new Person();
            $person.name=$processInstance.getVariable("person_name");
            $person.age=$processInstance.getVariable("age");
            $person.weight=$processInstance.getVariable("weight");
            insert($person);
    end

When I build the package I get the error "Unable to resolve ObjectType WorkflowProcessInstance"

I hope we should import org.drools.runtime.process.WorkflowProcessInstance in the rule to solve this error. How to add this import statement in the Guvnor's BRL editor?

Was it helpful?

Solution

In Guvnor, imports are configured in the package and not in each rule. In the same window where you build your package there are a box where you can add your own import. By default you will see an entry for each class in your model, but you can add your own imports as well (as long as the class you import is in Guvnor's classpath).

Best Regards,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top