JBoss Community

Re: How to get a process instance id within a sequence flow "condition expression"?

created by Dmitry Erkin in jBPM - View the full discussion

Hello, Maciej!

 

yes I have my process instances inserted as facts:

 

package defaultPackage

dialect "mvel"

 

import defaultPackage.Request;

import java.util.Map;

import java.util.HashMap;

import org.drools.runtime.process.ProcessInstance;

import org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl;

 

rule "start"

    when

        $rq:Request()

        not(WorkflowProcessInstanceImpl($request: variables["request"]) and (Request(this == $rq) from $request))

    then

        System.out.println(" >>> The approveRequest process will be started!");

        Map params = new HashMap();

        params.put("request", $rq);

        ProcessInstance pi = kcontext.getKnowledgeRuntime().createProcessInstance("defaultPackage.approveRequest", params);

        insert(pi);

        kcontext.getKnowledgeRuntime().startProcessInstance(pi.getId());

end

 

What I do not get is how to get a certain process instance attribute's value in a sequence flow's condition expression. By certain instance I mean the instance which is created to approve certain request. I have a request pocess variable, a request.id attribute for that variable and I want to make an inference over facts which relate to that certain request. A relation between facts stored in a session and certain request is set up through a request.id value.

 

Regards,

Dmitry Erkin

Reply to this message by going to Community

Start a new discussion in jBPM at Community