JBoss Community

Re: Java code accessing task variables

created by Chris Melas in jBPM - View the full discussion

Good i'm glad it worked out for :)

 

Actually, you can use several methods to set variables and parameters for example,

 

1. result mapping (as you already mentioned), if you want to map a process variable to a value from the result parameter of the task

2. parameter mapping (as loganathan mentioned) - here you can map parameters of the task with process variables

3. set a task parameter i.e. in the properties of the task at the content parameter field of the task place a notation like #{some_value_from_variable}

4. set process variables within on entry actions and on exit actions and then use the parameter mapping to map those variables to your task parameters and use them in your task i.e. (from the sample.bpmn of the jbpm5 installation),

 

on entry action

java.util.Map contentParam = new java.util.HashMap();

contentParam.put("reason", reason);

contentParam.put("performance", performance);

kcontext.setVariable("content", contentParam);

 

Parameter mapping

{Content=content}

 

5. on exit action you can set parameters to variables as shown in the code above

Reply to this message by going to Community

Start a new discussion in jBPM at Community