JBoss Community

Share drools fact declaration between rules

created by sandeep rao in jBPM - View the full discussion

Hi,

I am trying to get a sample of JBPM process design to work with constraints coded in drools. I am trying to evaluate my condition based on a process parameter.

 

So, I inserted processInstance into the working memory by adding a script task before my Gateway.

Here i added this code to onEntryAction: (This defines an instance of Stage that i want to access in my constraint)

 

 

import org.drools.runtime.process.WorkflowProcessInstance

global WorkflowProcessInstance processInstance;

declare Stage
    status1 : String
    status2 : String
    status3 : String
end

rule

    when
        processInstance : WorkflowProcessInstance()
    then
    Stage stage=new Stage();
    stage.setStatus1( processInstance.getVariable("status1") );
    stage.setStatus2( processInstance.getVariable("status2") );
    stage.setStatus3( processInstance.getVariable("status3") );
        insert (stage);
end

 

 

In the condition Expression section of the outgoinglink of my gateway I added

 

 

Stage(status1=="open")

 

 

This results in an error

 

Unable to resolve ObjectType 'Stage'

 

How do I access this objectType?

 

-Sandeep

Reply to this message by going to Community

Start a new discussion in jBPM at Community