JBoss Community

Re: Accessing process variables in rule-task

created by leon_ in jBPM - View the full discussion

Thanks very much for your reply Esteban.

I am sorry for being a bit unclear. It is my writing style, and I am working on it to define problems in a more clear way :-)

 

So, if I have a variable "monkey" in my BPMN process (which is added to the map btw), where the user has given a value to in an .ftl form, let's say "chimp". And I want a rule to fire based on the value "chimp" I would write something like:

 

rule A

         

          ruleflow-group "chimps_are_nice"

 

          when

                

                              (Map)((WorkflowProcessInstance) kcontext.getKnowledgeRuntime().getProcessInstance(WorkflowProcessInstance(.getId())).getVariable("monkey") ==  "chimp";

 

          then

              

                             (Map) (WorkflowProcessInstance (kcontext.getKnowledgeRuntime().getProcessInstance(WorkflowProcessInstance().getId()).setVariable("character") =  "nice";



 

 

I realise I can store the path into a variable to shorten the code. But this is what it would come down to I guess?
I am retrieving the variable from the map, is this neccesary or can it be ommitted?

I assum to set variables I use setVariable, am I right?

Reply to this message by going to Community

Start a new discussion in jBPM at Community