-
1. Re: Capturing the initiator user
imjorge Jul 27, 2010 1:23 PM (in response to klausdworschak)Disclaimer: jBPM 4.3 does not support historic on task reassignment. This means if task task1 is first assigned to user homer, then it is delegated manually or otherwise to user bart and finally to user marge, jBPM will only keep track of the last user, marge in this case, that was assigned to task1.
Having said that, if you are ok with getting the currently user assigned to a task you can use TaskService to create a TaskQuery filtering by process instance id and task name, as in the following example:
TaskService taskService = ...;
String processInstanceId = ...;
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstanceId).activityName("task1");Task task = taskQuery.uniqueResult();// task.getAssignee() contains the login of the user, if any, to which the task is assigned to. -
2. Re: Capturing the initiator user
klausdworschak Jul 28, 2010 2:08 AM (in response to imjorge)What I meant was workflow not task. Sorry for that.
I want to "capture" the user that started the whole workflow. I need a way for this user to keep track of workflows he started and for him to see which states that workflows are currently in.
-
3. Re: Capturing the initiator user
mwohlf Jul 28, 2010 3:33 AM (in response to klausdworschak)did you try using a swimlane for that?
-
4. Re: Capturing the initiator user
klausdworschak Jul 28, 2010 3:44 AM (in response to mwohlf)Can you please give me an example of how to do this in jBPM v4?
All examples I've found so far use jBPM v3 syntax (e.g. <start-state>, etc).
I've tried the following xml but i guess I'm doing it completely wrong.
....
<swimlane name="initator" assignee="${requestor}" />
<task name="TestTask" candidate-groups="${testTaskGroup1}" swimlane="initator" >
<transition to="end"/>
</task>....
-
5. Re: Capturing the initiator user
charles_a Jul 28, 2010 4:13 AM (in response to klausdworschak)1 of 1 people found this helpfulHi Klaus,
we had the same requirement. We use jbpm 4.4 and create a histroy variable on process start:
String userId = ...
ProcessInstance processInstance = ....
executionService.createVariable(processInstance.getId(), "initiatior", userId, true);
The "true" makes this variable a history variable. Especially useful as you could query the database for it (we do it outside of jbpm), even for ended processes. As we also need the initiator in a swimlane during process intatiation, so we additionally pass this value as a regular process parameter in the startProcessInstance method.
Cheers,
Charles
-
6. Re: Capturing the initiator user
rebody Jul 28, 2010 8:43 PM (in response to klausdworschak)Hi guys,
We really want to support this feature in the next version of jBPM 4. Please join our discussion and give us your advices, Thank you very much.
The post is here.