-
1. Re: Passing work item results to process variables
andymcc May 3, 2013 12:37 PM (in response to dmwpepper)Hi David
It looks like you and I are still walking on similar paths!
In case you've not seen it already this may be useful JBPM5 Example - Human Task Forms with Variables.
Paragraph 4 suggests that output parameters need to be passed out separately and not as a map - but it was written two years ago so may be well out of date!
Regards
Andy McC
-
2. Re: Passing work item results to process variables
dmwpepper May 3, 2013 1:13 PM (in response to andymcc)Hey Andy, yep, the path to enlightenment gets bumpy here and there. I didn't see this post, but did look through a number of others. Having reviewed it, I'm still not sure what passing output parameters separately means. Does that mean they're not captured in Eclipse/bpmn2, but instead are returned in a Java method/class? What's the purpose of Result Mapping if it can't put the results of a task into process variables?
-
3. Re: Passing work item results to process variables
salaboy21 May 5, 2013 8:58 AM (in response to dmwpepper)Hi David,
Did you check the Web Process Designer? That's definitely more updated than the Eclipse Plugin.
As you mention copying variables from the work item scope to the process scope and vice versa is something vital. You need to understand that for doing that you need to have the correct mappings in the process file and then make sure that your work item is filling the variables that the process is expecting to do the copy.
So for example let's say that you have a Process Variable called: String Customer_Name;
At process level you should have the variable defined. In your work item you will need to define the Customer_Name variable as an input variable if you want to display or use the content of the variable (maybe another activity change its value) and as an output variable if you want to override the process variable. These mappings will be something like this:
Customer_Name -> this is the process variable
Now inside the WorkItem
dataInputs:
in_Customer_Name -> This represents the internal Work Item variable, it's not yet mapped to the process variable
dataOutputs:
out_Customer_Name -> This represents the internal Work Item variable that will be copied back to the process, it's not yet mapped to the process variable
Assignments:
Customer_Name ---(Mapped to)--> in_Customer_Name -> This will copy the value of the process variable to the work Item in_Customer_Name when the process reach the work item node
out_Customer_Name ---(Mapped to)--> Customer_Name -> This will tell the process to override the process variable called Customer_Name with the value of the internal work item variable called out_Customer_name.
This mechanism is being defined by the BPMN2 language, and for that reason you need to have that in your xml file.
Notice that your WorkItemHandler will only work with in_Customer_name and out_Customer_Name, that means that your Map<String, Object> params will need to have those keys or at least the ones defined in the dataOutputs in order to override the Process variables when you complete the WorkItemHandler.
Hope this helps
Cheers
-
4. Re: Passing work item results to process variables
dmwpepper May 7, 2013 10:11 AM (in response to salaboy21)Hey Mauricio,
Thanks for your response. I use Eclipse for the Java development piece, so I needed to understand how it worked in that IDE, though it will eventually be used in the Web Process Designer and JBPM Console. Your answer helps some, but I needed to understand what to do in the Java work item code. I found a post on StackOverflow (http://stackoverflow.com/questions/9433776/jbpm-how-to-get-workitemhandler-results) that provided some hints no how to return the results in the work item so they can be used in the next service task.
Dave