JBoss Community

Re: How to get WorkItemHandler results

created by Esteban Aliverti in jBPM - View the full discussion

Let's say you have a "Calculate Random Number" Work Item. The WI Handler will calculate a random value, put it into a Map using some key:

 

Map<String, Object> result = new HashMap<String,Object>();

result.put("rndNumber", randomNumber);

 

manager.completeWorkItem(workItem.getId(), result);

 

In the process designer you will need to map the "rndNumber" result to some variable in your process. If you are using the web designer you have to add in the "associations" attribute of the Task:

 

rndNumber->processVariableThatWillHoldTheNumber

 

This is similar to what you have to do if you want to pass parameters to the Work Item.

 

Best Regards,

Reply to this message by going to Community

Start a new discussion in jBPM at Community