cancel
Showing results for 
Search instead for 
Did you mean: 

Set owner of taks in XML

kristofsl
Champ in-the-making
Champ in-the-making
Hi,

is it possible to set the owner of a task based on a process variable? Is it possible with a line like below?

<userTask id="AssignUserTask" name="AssignUserTask" activitiSmiley Surprisedwner="{ActivitiTaskOwner}"  activiti:candidateGroups="CSM, RD"></userTask>

If not, how can you dynamically set the owner the moment the task becomes active?

I was thinking about building a listener, but then I found the following in the Activiti in action book :

TIP The order of events for a user task is maybe not what you would expect.
The first event that’s thrown is the assignment event. After the assignment is
handled, the user task create event is fired.

This means that the owner is set via a listener after the assignment to a user is done?

thanks
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
I think your code-fragments didn't come through the was they should. Are you referring to the "owner" or the assignee?

The assignee can be set in XML using the activiti:assignee="…" attribute on the user task (or the BPMN-counterpart, see user guide). If you want to set the "owner", this can be done in a task-listener on the event="create", by calling delegateTask.setOwner(delegateTask.getExecution().getVariable("theVariableYouNeed")) or something similar…