Hi Everyone,

 

I doing a PoC @ client site and trying to figure out how to use the process variables in rule & human task.

For the PoC I'm using the designer & jBPM console with default config (out of the box). This is on BRMS 5.3.0 on EAP 5.1.2.

1.      The process model is pretty straight forward (see attachment):

                                                                                          User Task (client)

Start => Script Node => Business Rule X                                            X => Script Node (out) => End

                                                                                       User Task (employee)

2.      Process Variables;

String name;

String type

String flow

3.      For using the process variables in rule task - I'm using the value set in the process variable "flow" (in the action) to guide the transition in the XOR:

·        I have a script node where I'm inserting the ProcessInstance

kcontext.getKnowledgeRuntime().insert(kcontext.getProcessInstance());

·        I’m setting the RuleFlow-Group as name – in the Business Rule task

·        The rules I have are as follows

o   ruleflow-group "name"

                                             lock-on-active true

                                             when

                                                  $process : WorkflowProcessInstance()

                                                  $type : String() from (String)$process.getVariable("type")

                                                 eval($type == "field")

                                           then

       System.out.println("In Rule Field");

       ((WorkflowProcessInstance)kcontext.getKnowledgeRuntime().getProcessInstance($process.getId())).setVariable("flow", "field"); 

       update($process);

 

 

o   ruleflow-group "name"

               lock-on-active true

                     when

                           $process : WorkflowProcessInstance()

                                                       $type : String() from (String)$process.getVariable("type")

                                                       eval($type == "regular")

                                             then

                                                        System.out.println("In Rule Regular");

                                                         $process.setVariable("flow", "regular");

                                                          update($process);?

 

·        When I start the process in JBPM Console, it prints out a print statement in the script node and creates an agenda with the right rule but then it throws exception say cannot setVariable...

 

4.      For the using the process variables for Human Task - I remove the Business rule node and make the process mode transition to the user tasks.

·        Here I'm using the process variable "name" to be used as the Actor using the #{name} expression. The process creates a personal task in the jBPM Console for that user but I'm unable to open the form. It throws an exception saying that Expression "name" cannot be resolved in the form. I have generated the forms before starting the process in jBPM Console.

Any help will be greatly appreciated!!

Thx!!

-Ajay

 

_______________________________________________________________________

Ajay Phagura

Red Hat Consulting

Mobile: (510) 290-4634

Ajay@redhat.com

www.redhat.com